Skip to content

Code hint not narrowed properly on union of literal tupleΒ #46457

Open
@k8w

Description

Bug Report

πŸ”Ž Search Terms

  • code hint tuple
  • code hint union

πŸ•— Version & Regression Information

4.4.4

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

let value: ['a', 'v1'] | ['b', 'v2'] = ['a', 'v']; // Type 'v' here and get code hint

πŸ™ Actual behavior

image

The first element is 'a', so the type of value should be narrowed to ['a', 'v1'].
So that the code hint of the second element should only have 'v1', but actually got 'v1' | 'v2'.

The compile result is correct, but it is not consistent with code hint.

πŸ™‚ Expected behavior

image

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editorEffort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Help WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions