From f3fa69afcbad24bd94d1ae75979c7092097d54b8 Mon Sep 17 00:00:00 2001 From: Rizky Date: Fri, 2 Feb 2024 05:21:12 +0700 Subject: [PATCH] fix raw --- app/web/src/utils/script/types/prop.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/web/src/utils/script/types/prop.tsx b/app/web/src/utils/script/types/prop.tsx index fc099938..fa6722c3 100644 --- a/app/web/src/utils/script/types/prop.tsx +++ b/app/web/src/utils/script/types/prop.tsx @@ -47,13 +47,17 @@ export const extractProp = (prop: { for (const [k, v] of Object.entries(props)) { if (v.type) { - let const_or_type = "const"; - let str = v.type; - if (v.type.startsWith("type:")) { - str = v.type.substring("type:".length); - const_or_type = "type"; + if (k === "_raw") { + propTypes.push(v.type); + } else { + 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")};`); } - 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;`);