Skip to content

Instantly share code, notes, and snippets.

@pfftdammitchris
Created January 16, 2026 04:25
Show Gist options
  • Select an option

  • Save pfftdammitchris/cc64f53ffd2a7c8c763cbb96b0b6acbb to your computer and use it in GitHub Desktop.

Select an option

Save pfftdammitchris/cc64f53ffd2a7c8c763cbb96b0b6acbb to your computer and use it in GitHub Desktop.
The Power of TypeScript's Satisfies Operator - snippet-1.ts
// Using a type annotation
const theme: Record<string, string> = {
primary: '#3b82f6',
secondary: '#10b981',
danger: '#ef4444',
}
// Later in your code...
theme.primary.toUpperCase() // Works fine
// But what if you try to access a specific property?
const primaryColor = theme.primary
// TypeScript thinks this is just `string`, not the literal '#3b82f6'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment