Chore: improve typings

This commit is contained in:
Pieter Vander Vennet 2024-04-30 17:54:38 +02:00
parent 57a531f292
commit dd46bfdf3b

View file

@ -263,6 +263,9 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
return res return res
} }
public static NoNull<T>(array: T[] | undefined): (T[] | undefined)
public static NoNull<T>(array: undefined): undefined
public static NoNull<T>(array: T[]): T[]
public static NoNull<T>(array: T[]): NonNullable<T>[] { public static NoNull<T>(array: T[]): NonNullable<T>[] {
return <any>array?.filter((o) => o !== undefined && o !== null) return <any>array?.filter((o) => o !== undefined && o !== null)
} }