Closed zcf0508 closed 3 weeks ago
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 works in Vue Playground but doesn't work in VSCode with the latest Volar extension.
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.
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?
https://github.com/vuejs/language-tools/pull/4902
I tested the code with the latest version of
volar
, and it raised a similar problem.