Deriving Types From Values 15 exercises
solution

Pass keyof into an Indexed Access Type

One solution is to pass a union of the possible values into an indexed access type:


type AllPrograms = ProgramModeMap[
| "GROUP"
| "ANNOUNCEMENT"
| "ONE_ON_ONE"
| "SELF_DIRECTED"
| "PLANNED_ONE_ON_ONE"
| "PLANNED_SELF_DIRECTED"];

However, this has duplication and would require up

Loading solution