Distributive Omit in TS

Serhii Shramko /

Custom omit type that omits a property from all members, preserving union types.

type DistributiveOmit<T, K extends PropertyKey> = T extends any
  ? Omit<T, K>
  : never;