Closed
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