From 1e2a158b228af3da1e4dff24416aabc9c96131f6 Mon Sep 17 00:00:00 2001 From: Rizky Date: Sat, 27 Jul 2024 17:09:11 +0700 Subject: [PATCH] fix --- app/web/src/nova/ed/panel/popup/script/scope/scope.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 e30c6475..7a073d54 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,11 +192,15 @@ return typings; i++; if (v.mode === "local") { const im = tree_types.length; - tree_types.push(`\ + const fn = new Function(`return ${JSON.stringify(v.val)}`); + const local_type = `\ declare module "item-${im}" { - export const \$\$_${k} = ${v.val}; + const fn = ${fn.toString()}; + export const \$\$_${k}: ReturnType; } -`); +`; + 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 }); `,