Created
January 16, 2026 04:25
-
-
Save pfftdammitchris/ad6bd9e1765a636a03841b3fe64e2f88 to your computer and use it in GitHub Desktop.
The Power of TypeScript's Satisfies Operator - snippet-5.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Contract is explicit - great for function parameters and return types | |
| function createUser(data: UserInput): User { | |
| // ... | |
| } | |
| // But for objects, it widens the type | |
| const config: Config = { timeout: 5000 } | |
| // config.timeout is now just `number`, not `5000` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment