-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
π Search Terms
remove generic string type from union containing it with string literals / filter generic string out of union containing literal types
π Version & Regression Information
5.7
β― Playground Link
No response
π» Code
type LiteralString<T> = string extends T ? never : T;
type Test1 = LiteralString<string>; // never
type Test2 = LiteralString<"literal">; // "literal"
type Test3 = LiteralString<string | "literal"> // shoud be "literal"
π Actual behavior
Test3
ends up being never
π Expected behavior
Test3
should be "literal"
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug