type TrafflicLight = io.TypeOf<typeof TrafficLight>;
const TrafflicLight = io.enums({
Red: {canDrive: false, shouldDrive: false},
Yellow: {canDrive: true, shouldDrive: false},
Green: {canDrive: true, shouldDrive: true},
});
const canDrive = (light: TrafflicLight) => TrafflicLight.enums[light].canDrive;
const shouldDrive = (light: TrafflicLight) => TrafflicLight.enums[light].shouldDrive;
type TrafflicLight = io.TypeOf<typeof TrafficLight>;
const TrafflicLight = io.enums({
Red: {canDrive: false, shouldDrive: false},
Yellow: {canDrive: true, shouldDrive: false},
Green: {canDrive: true, shouldDrive: true},
});
const canDrive = (light: TrafflicLight) => TrafflicLight.enums[light].canDrive;
const shouldDrive = (light: TrafflicLight) => TrafflicLight.enums[light].shouldDrive;