Skip to content

Intellisense for strings within a type's Union doesn't work properly for JSX #50224

@pffigueiredo

Description

@pffigueiredo

Bug Report

Getting intellisense (auto-complete) from strings literals that belong to a union members in JSX components seems to only work, if we do it inside the "curly braces", if we try to get intellisense from plain "quotes", nothing will come up, even though TS still evaluates well the types.

🔎 Search Terms

#intellisense #string literals

🕗 Version & Regression Information

Since version 4.7, according to my tests, this was working correctly in version 4.6.4.

  • This changed between versions 4.6.4 and 4.7.4

⏯ Playground Link

Playground Link

💻 Code

type Props = {age: number} | { name: "box" };

declare function sampleFn(args: Props): any
declare function SampleComponent(args: Props): any

// Intelissense on the `name` property ✅
const a1 = sampleFn({name: "box"});

// Intelissense on the `name` property ✅
const a2 = <SampleComponent name={""} />

// No intelissense on the `name` property ❌
const a3 = <SampleComponent name="" />

🙁 Actual behavior

We don't get intellisense:

image

🙂 Expected behavior

Intesllisense should be available, since it is for regular TS functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: LS: Completion ListsThe issue relates to showing completion lists in an editorHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions