// I don’t understand why, but Omit (built-in) breaks discriminated unions. This type does not. // See https://github.com/microsoft/TypeScript/issues/31501#issuecomment-1079728677 export type RemoveKey = { [P in keyof T as Exclude]: T[P]; }