Determines if a type is a primitive string.
Works by checking the intersection of T with a random string.
T
""
never
The type to check.
type Test1 = IsPrimitiveString<string>; // truetype Test2 = IsPrimitiveString<"asdf">; // falsetype Test3 = IsPrimitiveString<number>; // false Copy
type Test1 = IsPrimitiveString<string>; // truetype Test2 = IsPrimitiveString<"asdf">; // falsetype Test3 = IsPrimitiveString<number>; // false
Determines if a type is a primitive string.
Works by checking the intersection of
T
with a random string.T
is a primitive string, the intersection will be the first random string, which does not extend""
.T
is is any other type, the intersection will benever
. For some reason,never
extends any type.