Skip to content

Commit

Permalink
fix: dynamic slot name breaks template type checking
Browse files Browse the repository at this point in the history
close #1392
  • Loading branch information
johnsoncodehk committed Jun 4, 2022
1 parent 3301e2e commit cfc1999
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vue-code-gen/src/generators/script.ts
Expand Up @@ -512,7 +512,12 @@ export function generate(
}

codeGen.addText(`});\n`);
codeGen.addText(`return {} as new () => InstanceType<typeof __VLS_Component> & { $slots: typeof import('./${path.basename(fileName)}.__VLS_template').default };\n`);
if (lsType === 'template') {
codeGen.addText(`return __VLS_Component;\n`);
}
else {
codeGen.addText(`return {} as new () => InstanceType<typeof __VLS_Component> & { $slots: typeof import('./${path.basename(fileName)}.__VLS_template').default };\n`);
}
codeGen.addText(`})();`);
exportdefaultEnd = codeGen.getText().length;

Expand Down

0 comments on commit cfc1999

Please sign in to comment.