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

Volar type errors if slot doesn't exist on component, even with passthrough slots #2233

Closed
kalvenschraut opened this issue Dec 19, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@kalvenschraut
Copy link
Contributor

kalvenschraut commented Dec 19, 2022

Example reproduction repo

After the last update, my builds are failing due to volar expecting slot to exist, but it thinks it doesn't.
Reason being is that the slots are being passed through to a child component using the $slots template variable.

image
image

Preferred fix would be volar to see $slots is being used in the template and then either allow anything as a valid slot i.e. type Record<string, unknown>, or
be smart enough to see they are being passed through to the child component, make those the allowed slots instead of {}.

At base level I would like a way to not have my build die in this specific case, seems I can't just add a @ts-ignore comment for this.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Dec 20, 2022

Thanks for the repro case! Fixed by daa842f and 70891a6.

For your use case, you can typed slot name with :name="(slot as 'before' | 'after')".

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Dec 20, 2022
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