Skip to content

Commit

Permalink
fix: don't modify component original interface when use setup script
Browse files Browse the repository at this point in the history
close #1391
  • Loading branch information
johnsoncodehk committed Jun 4, 2022
1 parent 16c5a1d commit 7b8148a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vue-code-gen/src/generators/script.ts
Expand Up @@ -525,7 +525,7 @@ export function generate(
codeGen.addText(`return __VLS_Component;\n`);
}
else {
codeGen.addText(`return {} as new () => InstanceType<typeof __VLS_Component> & { ${getSlotsPropertyName(vueVersion)}: typeof import('./${path.basename(fileName)}.__VLS_template').default };\n`);
codeGen.addText(`return {} as typeof __VLS_Component & (new () => { ${getSlotsPropertyName(vueVersion)}: typeof import('./${path.basename(fileName)}.__VLS_template').default });\n`);
}
codeGen.addText(`})();`);
exportdefaultEnd = codeGen.getText().length;
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-typescript/src/use/useSfcTemplateScript.ts
Expand Up @@ -128,7 +128,7 @@ export function useSfcTemplateScript(
/* Components */
codeGen.addText('/* Components */\n');
codeGen.addText('declare var __VLS_otherComponents: NonNullable<typeof __VLS_component extends { components: infer C } ? C : {}> & __VLS_types.GlobalComponents & typeof __VLS_vmUnwrap.components & __VLS_types.PickComponents<typeof __VLS_ctx>;\n');
codeGen.addText(`declare var __VLS_ownComponent: __VLS_types.SelfComponent<typeof __VLS_name, new () => InstanceType<typeof __VLS_component> & { ${getSlotsPropertyName(compilerOptions.experimentalCompatMode ?? 3)}: typeof __VLS_slots }>;\n`);
codeGen.addText(`declare var __VLS_ownComponent: __VLS_types.SelfComponent<typeof __VLS_name, typeof __VLS_component & (new () => { ${getSlotsPropertyName(compilerOptions.experimentalCompatMode ?? 3)}: typeof __VLS_slots })>;\n`);
codeGen.addText('declare var __VLS_allComponents: typeof __VLS_otherComponents & Omit<typeof __VLS_ownComponent, keyof typeof __VLS_otherComponents>;\n');
codeGen.addText('declare var __VLS_rawComponents: __VLS_types.ConvertInvalidComponents<typeof __VLS_allComponents> & JSX.IntrinsicElements;\n'); // sort by priority

Expand Down

0 comments on commit 7b8148a

Please sign in to comment.