Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Completions for string literal type parameter don't work if it's constraint includes an empty stringΒ #47227

Copy link
Copy link
@devanshj

Description

@devanshj
Issue body actions

Bug Report

πŸ”Ž Search Terms

String literal completions, empty string constraint, intellisense

πŸ•— Version & Regression Information

Tested with v4.5.4

⏯ Playground Link

Playground

πŸ’» Code

declare const foo1: (p: "" | "bar" | "baz") => void

foo1("")
//    ^|
// expected completions: "", "bar", "baz"
// actual completions: "", "bar", "baz"

declare const foo2: <P extends "" | "bar" | "baz">(p: P) => void

foo2("")
//    ^|
// expected completions: "", "bar", "baz"
// actual completions: none

πŸ™ Actual behavior

foo2 has no completions

πŸ™‚ Expected behavior

foo2 should have same completions like foo1 which are "", "bar", "baz"

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.