[Typescript 4.9] Satisfies operator
type RGB = [number, number, number]
const palette: Record<'red' | 'blue' | 'green', string | RGB> = {
red: [255, 0, 0],
green: "#00ff00",
blue: [0,0,255]
}
palette.red.lastIndexOf(0)
palette.green.toUpperCase()
V4.9:
type RGB = [number, number, number]
const palette = {
red: [255, 0, 0],
green: "#00ff00",
blue: [0,0,255]
} satisfies Record<'red' | 'blue' | 'green', string | RGB>
palette.red.lastIndexOf(0)
palette.green.toUpperCase()