This commit is contained in:
Rizky 2024-07-27 17:09:11 +07:00
parent d8b7553c3c
commit 1e2a158b22
1 changed files with 7 additions and 3 deletions

View File

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