Skip to content

[v3.2.0]: v-for with generic component unable to infer types #5895

@Q16solver

Description

@Q16solver

Vue - Official extension or vue-tsc version

3.2.0

VSCode version

1.107.1

Vue version

3.5.26

TypeScript version

5.9.3

System Info

package.json dependencies

Steps to reproduce

  1. Run pnpm i
  2. Run pnpm typecheck
  3. Observe that type error occurs
error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.  Type 'string' is not assignable to type 'number'.

What is expected?

No type errors, downgrade to v3.1.8 to observe that no type errors occur

What is actually happening?

Type error is occurring as the inferred type is "any", and results in v-for inferring index as string | number

Link to minimal reproduction

https://stackblitz.com/edit/github-gzbuzr-kwtq52yd

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions