Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save pfftdammitchris/c32fbf91a86b664063a85c528322df4b to your computer and use it in GitHub Desktop.
The Power of TypeScript's Satisfies Operator - snippet-23.ts
// Before: Type annotation causes widening
const theme: Record<string, string> = {
primary: '#3b82f6',
secondary: '#10b981',
}
// Later in code, you might see type guards like this
if ('primary' in theme) {
// Unnecessary check
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment