ThatDev.Shparki

Today I Learned

TIL: TypeScript satisfies operator

typescript til

The satisfies operator validates types without widening.

const colors = {
  red: '#ff0000',
  green: '#00ff00',
} satisfies Record<string, string>;

// colors.red is still string, not string | undefined

Better than as const when you need validation without narrowing.