Extracts all keys from a union type.
Unlike keyof, which only returns keys common to all members, this type returns all keys across the given union
keyof
type Result = UnionKey< | { a: string } | { b: number }>;// ^?// "a" | "b" Copy
type Result = UnionKey< | { a: string } | { b: number }>;// ^?// "a" | "b"
Extracts all keys from a union type.
Unlike
keyof, which only returns keys common to all members, this type returns all keys across the given union