Skip to content

Commit

Permalink
fix: cannot assign generic component to defineComponent components op…
Browse files Browse the repository at this point in the history
…tion

#2758
  • Loading branch information
johnsoncodehk committed May 1, 2023
1 parent 44357b1 commit 2f03416
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vue-language-core/src/generators/script.ts
Expand Up @@ -156,7 +156,7 @@ export function generate(
);
}
if (usedHelperTypes.ToTemplateSlots) {
codes.push(`type __VLS_ToTemplateSlots<T> = { [K in keyof T]: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : (props: T[K]) => any };\n`);
codes.push(`type __VLS_ToTemplateSlots<T> = { [K in keyof T]?: NonNullable<T[K]> extends (...args: any[]) => any ? T[K] : (props: T[K]) => any };\n`);
}
if (usedHelperTypes.PropsChildren) {
codes.push(`type __VLS_PropsChildren<S> = { [K in keyof (boolean extends (JSX.ElementChildrenAttribute extends never ? true : false) ? never : JSX.ElementChildrenAttribute)]?: S; };\n`);
Expand Down
10 changes: 10 additions & 0 deletions packages/vue-test-workspace/vue-tsc/#2758/app.vue
@@ -0,0 +1,10 @@
<script lang="ts">
import { defineComponent } from 'vue';
import MyComp from './main.vue';
export default defineComponent({
components: {
MyComp,
},
});
</script>

0 comments on commit 2f03416

Please sign in to comment.