Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 45x 44x 10x 8x 11x | export function isValidEnum<T extends readonly string[]>(
value: string | undefined,
allowedValues: T,
): value is T[number] {
if (!value) return false;
return allowedValues.includes(value as T[number]);
}
export function isValidEnumArray<T extends readonly string[]>(
values: unknown,
allowedValues: T,
): values is T[number][] {
if (!Array.isArray(values)) return false;
return values.every(
(v) => typeof v === "string" && allowedValues.includes(v as T[number]),
);
}
|