This commit is contained in:
Rizky 2024-07-27 17:17:37 +07:00
parent 91140280d4
commit 98aefbc20c
1 changed files with 3 additions and 2 deletions

View File

@ -192,15 +192,16 @@ return typings;
i++; i++;
if (v.mode === "local") { if (v.mode === "local") {
const im = tree_types.length; const im = tree_types.length;
const fn = new Function(`return ${v.val}`);
const local_type = `\ const local_type = `\
declare module "item-${im}" { declare module "item-${im}" {
export const \$\$_${k} = v.val; export const \$\$_${k} = ${fn.toString()};
} }
`; `;
tree_types.push(local_type); tree_types.push(local_type);
tree_usage.push({ tree_usage.push({
import: `import { \$\$_${k} } from "item-${im}";`, 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<typeof \$\$_${k}> & { render: ()=> void }); `,
}); });
} else if (v.mode === "prop") { } else if (v.mode === "prop") {
const im = tree_types.length; const im = tree_types.length;