TypeScript's built-in Omit utility type breaks discriminated unions by treating them as a whole rather than distributing over each union member. This causes type errors when building wrapper components that depend on discriminated union props. A distributive version using conditional types (T extends any ? Omit<T, K> : never)
•7m read time• From tkdodo.eu
Table of contents
Discriminated Union TypesDistributive Conditional TypesDistributive OmitLimited KeysSort: