-
-
Notifications
You must be signed in to change notification settings - Fork 438
Infer the type of item
in v-for
incorrectly
#4949
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
Labels
Comments
The error in latest version of volar was caused by another issue and has been reverted. Could you try explicit type constraints? const list: Ref<T[]> = ref([]); This is a core type issue. |
It will be fixed in the next version. |
The above problem can be attributed to this part of the code: let a: T = ref<T>(null!); Because generic parameters in the template will not be dereferenced automatically. You can open a issue or discussion in the core. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vue - Official extension or vue-tsc version
2.1.8
VSCode version
1.95.0-insider
Vue version
3.5.12
TypeScript version
5.6.3
System Info
No response
package.json dependencies
No response
Steps to reproduce
https://play.vuejs.org/#eNp9U21r2zAQ/is3fYkDmUPX7UvmBLZRWMdeyhrYh6oMY59dNbIkJNlJMf7vO8mJW1joJ+vuuZfn7h737JMxadciW7HMFVYYDw59azZcicZo66EHixUMUFndwIxCZ1xxVWjlPDSuhnXAk9lXlFLDH21l+WY25ypbjuWoEBkeGyNzj2QBZA8Xm76PycOQLcmKXqFM66F72+gS5ZozwjmDJYHZ8kU+WzDvqH0l6vTRaUXM+5DPWaEbIyTaX8YLosfZCiISsJzY7b9Fn7ctLk7+4gGL3Rn/ozsEH2c3Fh3aDjmbMJ/bGv0IX93+xAO9J5DYt5KiXwF/o9OyDRzHsM+tKon2i7jI9jruX6h6664OHpU7DRWIhsghxnNGN/nyyujPdC/T9zGPq4G2+F04f+70IHNV0/49lYEaFVpRkLnlLN5ykoVWP3SrPJaL/xTy8SQQY7VxJJESK6HwJlhZJEaMQv8VJHNYbyAhqBEOs+3d/YbUM2ySORXhaky8ldofEy2Sz16TICi3B0EPGGja+FrBFoZYsFU7pfdUYKo0EpLUdJRsbJXc3VM3rqZZktw9qeLIKjYMGWmXyxYpL9/n4jhVehwhCXRjkUny5zRfio60XWlLq0wC1wUImuQwp0/sQcte7fCJ4OiP2w4HzBwNDypvkKDn6UN4KBPiRzP8KRS+pE5n/pm/HdqgILr2ZfohvXjHhn82eFRe
What is expected?
list
type isT[]
, anditem
type should beT
.What is actually happening?
Type 'UnwrapRefSimple' is not assignable to type 'T'.
Link to minimal reproduction
https://play.vuejs.org/#eNp9U21r2zAQ/is3fYkDmUPX7UvmBLZRWMdeyhrYh6oMY59dNbIkJNlJMf7vO8mJW1joJ+vuuZfn7h737JMxadciW7HMFVYYDw59azZcicZo66EHixUMUFndwIxCZ1xxVWjlPDSuhnXAk9lXlFLDH21l+WY25ypbjuWoEBkeGyNzj2QBZA8Xm76PycOQLcmKXqFM66F72+gS5ZozwjmDJYHZ8kU+WzDvqH0l6vTRaUXM+5DPWaEbIyTaX8YLosfZCiISsJzY7b9Fn7ctLk7+4gGL3Rn/ozsEH2c3Fh3aDjmbMJ/bGv0IX93+xAO9J5DYt5KiXwF/o9OyDRzHsM+tKon2i7jI9jruX6h6664OHpU7DRWIhsghxnNGN/nyyujPdC/T9zGPq4G2+F04f+70IHNV0/49lYEaFVpRkLnlLN5ykoVWP3SrPJaL/xTy8SQQY7VxJJESK6HwJlhZJEaMQv8VJHNYbyAhqBEOs+3d/YbUM2ySORXhaky8ldofEy2Sz16TICi3B0EPGGja+FrBFoZYsFU7pfdUYKo0EpLUdJRsbJXc3VM3rqZZktw9qeLIKjYMGWmXyxYpL9/n4jhVehwhCXRjkUny5zRfio60XWlLq0wC1wUImuQwp0/sQcte7fCJ4OiP2w4HzBwNDypvkKDn6UN4KBPiRzP8KRS+pE5n/pm/HdqgILr2ZfohvXjHhn82eFRe
Any additional comments?
#4902
I tested the code with the latest version of
volar
, and it raised a similar problem.The text was updated successfully, but these errors were encountered: