KeysOfUnion
Get all keys from a union of object types.
#types
#typescript
#utility-type
export type KeysOfUnion<T> = T extends T ? keyof T : never;
// Usagetype A = { a: string; shared: number };type B = { b: boolean; shared: number };
type AllKeys = KeysOfUnion<A | B>;// 'a' | 'b' | 'shared'