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

v2.2.0 useSlots Type resolution failure #5116

Open
SevenJoker opened this issue Jan 8, 2025 · 4 comments
Open

v2.2.0 useSlots Type resolution failure #5116

SevenJoker opened this issue Jan 8, 2025 · 4 comments

Comments

@SevenJoker
Copy link

Vue - Official extension or vue-tsc version

2.2.0

VSCode version

1.96.1

Vue version

3.4.21

TypeScript version

use jsdoc

System Info

No response

package.json dependencies

No response

Steps to reproduce

image

What is expected?

image

What is actually happening?

useSlots result type is any
rollback version to 2.1.10 is normal
image

Link to minimal reproduction

No response

Any additional comments?

No response

@KazariEX
Copy link
Collaborator

KazariEX commented Jan 8, 2025

How do you use slots in the template?

@KazariEX
Copy link
Collaborator

KazariEX commented Jan 8, 2025

See #5055 (comment)

If you want to get an slots object without type inference and use it in the template, it would be better to use const slots = defineSlots() to skip type resolution.

@realByg
Copy link

realByg commented Jan 10, 2025

Usage of slots and attrs inside <script setup> should be relatively rare, since you can access them directly as $slots and $attrs in the template.

https://vuejs.org/api/sfc-script-setup#useslots-useattrs

@KazariEX
Copy link
Collaborator

Just a defineSlots(), no need to use its return value, you can continue to use $slots in the template.

https://vuejs-language-tools.vercel.app/zh/features/slots

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

No branches or pull requests

3 participants