Invalid component types generated for generic Vue components when migrating from Typescript 5.4.4 -> 5.5.2 #4577
Labels
bug
Something isn't working
good reproduction ✨
This issue provides a good reproduction, we will be able to investigate it first
Vue - Official extension or vue-tsc version
vue@3.4.21, vue-tsc@2.0.26
VSCode version
1.90.1 (Universal)
Vue version
3.4.21
TypeScript version
5.5.2
System Info
Steps to reproduce
See reproduction https://github.com/its-lee/vue-tsc-incompatible-vue-lib-types, but:
What is expected?
vue-tsc should find no Typescript errors and the generated types for package A should be consistent.
What is actually happening?
A couple of issues with this generated .d.ts that if I change resolves the issue:
__VLS_BuiltInPublicProps
isn't defined anywhere - hackily commenting this out helps resolve the issue but it should be defined somewhere in the same way__VLS_Prettify
has been?__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"]
uses NonNullable - which is good, as __VLS_setup could be undefined. However,__VLS_props
and__VLS_ctx
incorrectly don't use NonNullable onAwaited<typeof __VLS_setup>
, so they are generating TS errors as e.g.Awaited<typeof __VLS_setup>['props']
won't work whenAwaited<typeof __VLS_setup>
is undefined.Link to minimal reproduction
https://github.com/its-lee/vue-tsc-incompatible-vue-lib-types
Any additional comments?
Ran into this when migrating a Vue component library from Typescript 5.4.4 -> 5.5.2.
For reference, typescript 5.4.4 generated this which is consistent and worked A-OK, containing no type errors and not using any types that aren't declared anywhere (e.g.
__VLSBuildInPublicProps
) - it's quite substantially different which is surprising!The text was updated successfully, but these errors were encountered: