Created
January 16, 2026 04:24
-
-
Save pfftdammitchris/ec5cb1ca281da7dadd0c1d7a1c3be8c0 to your computer and use it in GitHub Desktop.
The Power of TypeScript's Satisfies Operator - snippet-24.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
| // After: satisfies preserves literal types | |
| const theme = { | |
| primary: '#3b82f6', | |
| secondary: '#10b981', | |
| } satisfies Record<string, string> | |
| // No more unnecessary type guards! | |
| theme.primary // TypeScript knows this exists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment