Server: Update typescript.
This commit is contained in:
parent
ac8159ce1d
commit
94e35b0bb4
3 changed files with 8 additions and 6 deletions
server/shared/types
|
@ -144,7 +144,9 @@ export function toIsArray<T>(isT: TypeGuard<T>): TypeGuard<T[]> {
|
|||
return (arg): arg is T[] => isArray(arg, isT);
|
||||
}
|
||||
|
||||
export function toIsEnum<E>(enumDef: E): EnumTypeGuard<E> {
|
||||
export function toIsEnum<E extends Record<keyof E, ValueOf<E>>>(
|
||||
enumDef: E
|
||||
): EnumTypeGuard<E> {
|
||||
return (arg): arg is ValueOf<E> =>
|
||||
Object.values(enumDef).includes(arg as [keyof E]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue