vuejs/language-tools

Types wrongly inferred in v-for

Closed this issue · 3 comments

Vue - Official extension or vue-tsc version

2.1.8

VSCode version

using WebStorm 2024.2.4

Vue version

3.5.12

TypeScript version

5.6.3

System Info

System:
    OS: macOS 15.0.1
    CPU: (8) arm64 Apple M1
    Memory: 193.92 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.9.0 - /usr/local/bin/npm
    pnpm: 9.12.2 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 130.0.6723.70
    Safari: 18.0.1

package.json dependencies

No response

Steps to reproduce

Installing the latest version of vue-tsc and using a v-for is not setting the correct type to the looped item:

image

image

Causing the called methods that accepts the correctly type object to break:

image

What is expected?

In the example, it's expected for header to be of type ITableHeader

What is actually happening?

In the example, header is not of type ITableHeader but has all its properties

Link to minimal reproduction

No response

Any additional comments?

No response

Rolling back to v2.0.29 fixes the problem

Duplicate of #4948

Duplicate of #4948

Sorry @KazariEX, I've searched for this issue only in still open issues.
I've should have searched also in the closed ones.

Thank you!