Deviopath › TypeScript

Next Traffic Light

Easy · Literal Types

The type Light = "red" | "green" | "yellow" only allows these three strings.

Write nextLight(light: Light): Light that returns the next color: red becomes green, green becomes yellow, and yellow becomes red.

Next: Validate a Size