Skip to content
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

TypeScript Inference Issue with defineSlots #4274

Open
Pantelakos opened this issue Apr 16, 2024 · 0 comments
Open

TypeScript Inference Issue with defineSlots #4274

Pantelakos opened this issue Apr 16, 2024 · 0 comments

Comments

@Pantelakos
Copy link

Problem

When using typescript with vue's slot templates, there's a typescript error. The type of an object is specified in a slot template and typescript fails to recognize the specific type. Basically we have a child class which extends a main class which then I use the main class as the type definition inside defineSlots, but it doesn't recognize the slot type when using it in a template even though the child class is extending the main class.
The typing problem exists with defineSlots and not with defineProps.

image

Reproduction

Check out this project to reproduce it by just running a npm run type-check:
https://stackblitz.com/edit/vue-tsc-ts-slot-issue?file=src%2Fcomponents%2FReproProblem.vue

The VS Code IntelliSense displays this error too.

Expected

The typing should be recognized just like in defineProps.

Dependency versions

vue-tsc - 2.0.13
typescript - 5.4.5
vue - 3.4.21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant