export function filterNullish(arr: (T | null | undefined)[]): T[] { return arr.filter((x): x is T => x !== undefined && x !== null); }