(value: string, allowedValues: readonly TValue[], label: string)
| 35 | } |
| 36 | |
| 37 | function parseEnumValue<TValue extends string>(value: string, allowedValues: readonly TValue[], label: string): TValue { |
| 38 | if (allowedValues.includes(value as TValue)) { |
| 39 | return value as TValue; |
| 40 | } |
| 41 | |
| 42 | throw new InvalidArgumentError(`Unsupported ${label}. Expected one of: ${allowedValues.join(', ')}.`); |
| 43 | } |