HomeSegun Adebayo

DistributiveOmit

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

  • #typescript
distributive-omit.ts
export type DistributiveOmit<T, U> = T extends any
  ? Pick<T, Exclude<keyof T, U>>
  : never

Tweet this snippet

Edit on github

Segun Adebayo

Passionate UI engineer looking to bridge the gap between design and code

All rights reserved © Segun Adebayo 2024