Skip to content

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

Closed
@devanshj

Description

@devanshj

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions