-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Slots type resolution is broken in 2.2.0 #5082
Comments
Circular reference occurred, it would be better to use |
use for what specificly?
|
Yep, good as workaround, didn't think of that solution before. Still believe should work as in 2.1.10 (IMO) since this is not per-Vue doc and a bit counterintuitive since slots should always be optional. |
This might be a core issue since its type is not processed here, please feel free to open an issue to the core repository. About OAPI it was a mistake I made, will fix it :) |
Thanks! I'll try to review core types, also noticed they didn't have possible-undefined for useSlots/$slots in CAPI, but thought was something vue-tsc -related |
Similar issue, on <div v-if="$slots.after">
<slot name="label" />
</div> Adding the defineSlots<{
label?: () => any
}>() |
Just for the info, started receiving same error in vue-tsc 2.2.0 Gives lint error:
Work-around that works:
|
Vue - Official extension or vue-tsc version
2.2.0
VSCode version
Not using it
Vue version
3.5.13
TypeScript version
5.6.3
System Info
System: OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish) CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P Memory: 10.44 GB / 11.68 GB Container: Yes Shell: 5.1.16 - /bin/bash Binaries: Node: 20.12.2 - /usr/local/bin/node Yarn: 1.22.19 - /usr/bin/yarn npm: 10.5.0 - /usr/local/bin/npm pnpm: 9.9.0 - ~/.local/share/pnpm/pnpm
package.json dependencies
Steps to reproduce
Try to use useSlots/check for slots in template
What is expected?
No error is thrown
What is actually happening?
This condition will always return true since this function is always defined. Did you mean to call it instead?
errorAlso, I wasn't able to reproduce it in hello world, but I also had "any" resolution for useSlots and $slots.
Also this is obviously not valid code but the error is weird
We always had slots type resolution error in OAPI with "this assigment will always return true" even though it's by documentation
But it seems like this time it got more broken than before
Link to minimal reproduction
https://github.com/daniluk4000/vue-volar-slots-bug
Any additional comments?
Only happening since 2.2.0. 2.1.10 produces correct errors (if we assume $slots check in OAPI should return this always true error)
The text was updated successfully, but these errors were encountered: