Skip to content

Commit

Permalink
Update distributed omit description
Browse files Browse the repository at this point in the history
  • Loading branch information
henriqueinonhe committed Mar 18, 2024
1 parent 0d5b833 commit 9898ced
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/distributed-omit.d.ts
Expand Up @@ -3,7 +3,9 @@ import type {KeysOfUnion} from './keys-of-union';
/**
Omits keys from a type, distributing the operation over a union.
TypeScript's `Omit` doesn't distribute over unions, which causes the following situation:
TypeScript's `Omit` doesn't distribute over unions, leading to the erasure of unique properties from union members when omitting keys. This creates a type that only retains properties common to all union members, making it impossible to access member-specific properties after the Omit. Essentially, using `Omit` on a union type merges the types into a less specific one, hindering type narrowing and property access based on discriminants. This type solves that.
Example:
```
type A = {
Expand Down

0 comments on commit 9898ced

Please sign in to comment.