// https://dev.to/safareli/pick-omit-and-union-types-in-typescript-4nd9 // https://github.com/microsoft/TypeScript/issues/28339#issuecomment-467393437 /** * This allows omitting keys from objects inside unions, without merging the individual components of the union. */ type Keys = keyof T; type DistributiveKeys = T extends unknown ? Keys : never; type Omit_ = Omit>; export type DistributiveOmit = T extends unknown ? keyof Omit_ extends never ? never : { [P in keyof Omit_]: Omit_[P] } : never;