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

Can't type dynamic slot when using strict mode for typescript #2266

Closed
kalvenschraut opened this issue Dec 30, 2022 · 4 comments
Closed

Can't type dynamic slot when using strict mode for typescript #2266

kalvenschraut opened this issue Dec 30, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@kalvenschraut
Copy link
Contributor

reproduction

Basically the issue is that with strict mode, typescript complains that string | number (type from keyof $slots) can't index the slots object that is inferred from the component you added it to. Not sure how to fix this specifically, if volar has to make a change or if there is a way I can get typescript to not error here.

@johnsoncodehk
Copy link
Member

Just had a look, this appears to be a duplicate of #625.

@kalvenschraut
Copy link
Contributor Author

Doesn't appear obvious to me that it is, but if you say so.

Is there a way to ignore/get around this type error? one only ones I have left before I can turn on strict mode

@kalvenschraut
Copy link
Contributor Author

kalvenschraut commented Dec 30, 2022

Tried something like the below, but receiving a different error.

image

@kalvenschraut
Copy link
Contributor Author

Weird the error just went away after awhile, vue-tsc doesn't error so I guess this works.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants