diff --git a/app/web/src/utils/script/types/prop.tsx b/app/web/src/utils/script/types/prop.tsx index 7d27e999..fc099938 100644 --- a/app/web/src/utils/script/types/prop.tsx +++ b/app/web/src/utils/script/types/prop.tsx @@ -47,7 +47,13 @@ export const extractProp = (prop: { for (const [k, v] of Object.entries(props)) { if (v.type) { - propTypes.push(`const ${k}: ${trim(v.type, "; \n")};`); + let const_or_type = "const"; + let str = v.type; + if (v.type.startsWith("type:")) { + str = v.type.substring("type:".length); + const_or_type = "type"; + } + propTypes.push(`${const_or_type} ${k}: ${trim(str, "; \n")};`); } else if (v.val) { if (typeof v.val === "object" && isValidElement(v.val)) { propTypes.push(`const ${k}: ReactElement;`);