showing results for - "typescript filter array of null"
Nathael
07 Aug 2019
1function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
2    return value !== null && value !== undefined;
3}
4
5const array: (string | null)[] = ['foo', 'bar', null, 'zoo', null];
6const filteredArray: string[] = array.filter(notEmpty);