TDistributedOmit
Bun

type

__internal.DistributedOmit

type DistributedOmit<T, K extends PropertyKey> = T extends T ? Omit<T, K> : never

Like Omit, but correctly distributes over unions. Most useful for removing properties from union options objects, like Bun.SQL.Options

type X = Bun.DistributedOmit<{type?: 'a', url?: string} | {type?: 'b', flag?: boolean}, "url">
// `{type?: 'a'} | {type?: 'b', flag?: boolean}` (Omit applied to each union item instead of entire type)

type X = Omit<{type?: 'a', url?: string} | {type?: 'b', flag?: boolean}, "url">;
// `{type?: "a" | "b" | undefined}` (Missing `flag` property and no longer a union)