From c43200a328147c7303dc5ba5fefdb0a1cd9736d3 Mon Sep 17 00:00:00 2001 From: Rizky Date: Sat, 27 Jul 2024 17:16:30 +0700 Subject: [PATCH] fix --- app/web/src/nova/ed/panel/popup/script/scope/scope.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx b/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx index 7a073d54..174567b2 100644 --- a/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx +++ b/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx @@ -192,18 +192,16 @@ return typings; i++; if (v.mode === "local") { const im = tree_types.length; - const fn = new Function(`return ${JSON.stringify(v.val)}`); + const fn = new Function(`return ${v.val}`); const local_type = `\ declare module "item-${im}" { - const fn = ${fn.toString()}; - export const \$\$_${k}: ReturnType; + export const \$\$_${k} = ${fn.toString()}; } `; - console.log(local_type); tree_types.push(local_type); tree_usage.push({ import: `import { \$\$_${k} } from "item-${im}";`, - usage: `const ${k} = null as unknown as (typeof \$\$_${k} & { render: ()=> void }); `, + usage: `const ${k} = null as unknown as (ReturnType & { render: ()=> void }); `, }); } else if (v.mode === "prop") { const im = tree_types.length;