Skip to content

DistributiveOmit

Same as Omit, but works with unions.

import { DistributiveOmit } from 'crustack/types'
// works as expected:
// Omit<{ a: string, b: string }, "c"> | Omit<{ b: string, c: string }, "c">
type T = DistributiveOmit<{ a: string; b: string } | { b: string; c: string }, 'c'>
// forgets both 'a' and 'c':
// { b: string }
type U = Omit<{ a: string; b: string } | { b: string; c: string }, 'c'>