Type error in v-for
on Object with key and value
#12318
Labels
has workaround
A workaround has been found to avoid the problem
language-tools
related to vue language-tools
scope: types
Vue version
3.5.12
Link to minimal reproduction
https://play.vuejs.org/#eNp9UctOwzAQ/JWVL1CppILCpUorAeoBDoCAG0YoTTdpWse2/AhFUf6dtaOUHlBvnt3Z2dlxy261ThqPbMZSh7UWmcMFlwCphuaiUGbOWZMJj2PY4Q9UEtRqy1mkALQtFEqdU2cEXTcLOJIJRI2JJmI6ORImaHNTaQcikyWJO8sZWHQ+UHMlrQsbSAo+SHYG1plKlp/DAzqYQxvEsxmcZUJvsrNxgCuCK3QR0XIuCy9zVykZHTbD/KgfNrTQSGgiN530lhZsTHbIQ1GVydYqSaFENme5qnUl0DzrIEmWyWAfAWeZEOr7MdacoaCGer7BfPdPfWv3ocbZi0GLpkHODj2XmRJd316+PeGe3odmrdZeEPtE8xWtEj547Gl3Xq7J9hEvun2otTKO4ni3y71DaYejgtHA7CKfvt7j/YnT/+xOk+s4R4FSil8NmqBJAU6Tm+TyinW/1cjLDA==
Steps to reproduce
Using
v-for="value, key in someObject"
onsomeObject: { [key: string]: string }
produces type onkey
What is expected?
Type of
key
should bestring
What is actually happening?
Type of
key
isstring | number
System Info
No response
Any additional comments?
According to the changelog, this should've been fixed in 3.4.28.
It feels like a regression of #8819, but changing the version of playground to 3.4.28 still has the same issue.
If I change the type of an object to
Record<string, string>
, the issue goes away.The text was updated successfully, but these errors were encountered: