Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save pfftdammitchris/f0bed772cda7ab3891d2e75f0b430f50 to your computer and use it in GitHub Desktop.
The Power of TypeScript's Satisfies Operator - snippet-8.ts
type RGB = [number, number, number]
type Color = string | RGB
const palette = {
red: [255, 0, 0],
green: '#00ff00',
blue: [0, 0, 255],
} satisfies Record<string, Color>
// TypeScript knows the exact type of each property!
palette.red[0] // number (knows it's an array)
palette.green.toUpperCase() // works! (knows it's a string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment