Skip to content

Commit

Permalink
Updated FAQ (markdown)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanCavanaugh committed Apr 22, 2024
1 parent c9dbad3 commit 1587b6a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,17 @@ This flag is a "big hammer", so to speak, and does not have any mechanisms for d
### Require Properties to Either Be Missing or Not `undefined`: `exactOptionalPropertyTypes`

You can turn on `exactOptionalPropertyTypes` to change the behavior such that an optional property can't be explicitly provided with the value `undefined`.
This has important effects on things like object spread:
```ts
type Foo = { bar: number };
const base: Foo = { bar: 42 };
// Somewhat-suspect initialization of Partial<Foo>
const partial: Partial<Foo> = { bar: undefined };

// If using spread, the 'undefined' value can be present
// at Foo.bar
const possiblyBad: Foo = { ...base, ...partial };
```

This flag affects *all* optional properties and there is no mechanism for doing this on a per-type basis.

Expand Down

0 comments on commit 1587b6a

Please sign in to comment.