TrafficLightState with three states: red, yellow, and green.type property with a string literal matching the state name.duration property (number) to each state representing how long the light stays in that state.currentState of type TrafficLightState and initialize it to the red state with duration 30.nextState that takes a TrafficLightState and returns the next state in the cycle: red -> green -> yellow -> red.switch statement on the type property inside nextState to determine the next state.type and duration of the currentState after transitioning through all states once.