Skip to content

Commit e6a097b

Browse files
committed
fix: Use custom field type in all fields
Cstom field types will be fetched regardless of the field type. If one is found, it is returned.
1 parent cfd5aaa commit e6a097b

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/features/schema/helper/typescriptHelpers.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export function getTypescriptFieldType(
4444
className: string,
4545
config?: { customClassFieldTypes?: CustomClassFieldType[] }
4646
): { type: string; importfrom?: string } {
47+
if (config && fieldName && className) {
48+
const custom = getCustomFieldType(config, className, fieldName);
49+
if (custom) return custom;
50+
}
51+
4752
switch (fieldAttributes.type) {
4853
case "String":
4954
return { type: "string" };
@@ -54,21 +59,11 @@ export function getTypescriptFieldType(
5459
case "Boolean":
5560
return { type: "boolean" };
5661

57-
case "Object": {
58-
if (config && fieldName) {
59-
const custom = getCustomFieldType(config, className, fieldName);
60-
if (custom) return custom;
61-
}
62+
case "Object":
6263
return { type: `any` };
63-
}
6464

65-
case "Array": {
66-
if (config && fieldName) {
67-
const custom = getCustomFieldType(config, className, fieldName);
68-
if (custom) return custom;
69-
}
65+
case "Array":
7066
return { type: `any[]` };
71-
}
7267

7368
case "Date":
7469
if (sdk) {

0 commit comments

Comments
 (0)