vetur icon indicating copy to clipboard operation
vetur copied to clipboard

narrowed type information disappears inside `v-for`

Open NiloCK opened this issue 3 years ago • 1 comments

  • [x] I have searched through existing issues (not exhaustively)
  • [x] I have read through docs
  • [x] I have read FAQ
  • [x] I have tried restarting VS Code or running Vetur: Restart VLS

Info

  • Platform: Linux

  • Vetur version: 0.35.0

  • VS Code version: 1.63.2

  • Typescript version: ^3.5.3 (pkg.json), 3.9.10 (yarn.lock)

  • "vue": "^2.6.10", 2.6.14 (yarn.lock)

  • "vue-class-component": "^6.3.2", 6.3.2 (yarn.lock)

  • "@typescript-eslint/eslint-plugin": "^4.18.0",

  • "@typescript-eslint/parser": "^4.18.0",

Problem

no vetur error message, just getting incorrect warnings on a narrowed type.

lost narrowing in v-for

Play-by-play:

  • token is a marked.Token, which is a discriminated union type of ... tokens.
  • token.type === 'paragraph' narrows the type to marked.Tokens.Paragraph
  • (line 44) correct narrowed type is inferred
  • (line 47) the inferred type information is lost

Reproducible Case

n/a. Can attempt at a later date if necessary.

NiloCK avatar Feb 07 '22 03:02 NiloCK

Please provide a repro case. https://github.com/vuejs/vetur/blob/master/.github/NO_REPRO_CASE.md

yoyo930021 avatar Nov 01 '22 10:11 yoyo930021