Created
January 16, 2026 04:25
-
-
Save pfftdammitchris/466a5e8d507a3ee059ff38ae977a4f53 to your computer and use it in GitHub Desktop.
The Power of TypeScript's Satisfies Operator - snippet-2.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
| // No type annotation | |
| const theme = { | |
| primary: '#3b82f6', | |
| secondary: '#10b981', | |
| danger: '#ef4444', | |
| } | |
| // Great! TypeScript knows the exact keys and values | |
| theme.primary // Type is '#3b82f6' | |
| theme.primry // Error! Property 'primry' does not exist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment