type TrafficLight = "yellow" | "green";
function getNextLight(current) {
switch (current) {
case "red":
return "green";
case "green":
return "yellow";
case "yellow":
return "red";
default:
throw new Error("Invalid traffic light state");
}
}