7 lines
121 B
TypeScript
7 lines
121 B
TypeScript
|
export function choose<U, T extends Record<string, U>>(
|
||
|
value: keyof T,
|
||
|
choices: T,
|
||
|
): U {
|
||
|
return choices[value]
|
||
|
}
|