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
Twith a random string.Tis a primitive string, the intersection will be the first random string, which does not extend"".Tis is any other type, the intersection will benever. For some reason,neverextends any type.