What does TypeScript’s ‘exactOptionalPropertyTypes’ flag change about the following type? interface Config { timeout?: number; }
Key points
- The flag enforces a distinction between 'absent' and 'undefined'
- It requires explicit 'undefined' for optional properties
- Setting a property to 'undefined' without the flag is considered an error
- The flag ensures more precise type checking for optional properties
Ready to go further?
