Skip to content

fix(language-core): loose props check on generic components without strictTemplates #4983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: loose props check on generic components without strictTemplates
  • Loading branch information
KazariEX committed Nov 4, 2024
commit eb9fd169590d6f1a4bdadcd123e41f1ff5cfce31
2 changes: 1 addition & 1 deletion packages/language-core/lib/codegen/script/scriptSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function* generateScriptSetup(
}

yield `return {} as {${newLine}`
+ ` props: ${ctx.localTypes.PrettifyLocal}<typeof __VLS_functionalComponentProps & __VLS_TemplateResult['attrs'] & __VLS_PublicProps> & __VLS_BuiltInPublicProps,${newLine}`
+ ` props: ${ctx.localTypes.PrettifyLocal}<typeof __VLS_functionalComponentProps & __VLS_TemplateResult['attrs'] & __VLS_PublicProps> & __VLS_BuiltInPublicProps${options.vueCompilerOptions.strictTemplates ? `` : ` & Record<string, unknown>`},${newLine}`
+ ` expose(exposed: import('${options.vueCompilerOptions.lib}').ShallowUnwrapRef<${scriptSetupRanges.expose.define ? 'typeof __VLS_exposed' : '{}'}>): void,${newLine}`
+ ` attrs: any,${newLine}`
+ ` slots: __VLS_TemplateResult['slots'],${newLine}`
Expand Down
5 changes: 5 additions & 0 deletions test-workspace/tsc/passedFixtures/vue3/#4972/comp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script setup lang="ts" generic="T">
defineModel<T>({
required: true
});
</script>
8 changes: 8 additions & 0 deletions test-workspace/tsc/passedFixtures/vue3/#4972/main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script setup lang="ts">
import Comp from './comp.vue';
</script>

<template>
<!-- @vue-expect-error -->
<Comp foo="..." />
</template>
Loading