A utility function that can be used in .filter calls to remove undefined values and assert that the type is not longer undefined.
.filter
undefined
The type that is not undefined.
The value to check.
const arr: (number | undefined)[] = [1, 2, 3, undefined]; const filtered = arr.filter(notUndefined); // filtered = [1, 2, 3] and its type is number[] Copy
const arr: (number | undefined)[] = [1, 2, 3, undefined]; const filtered = arr.filter(notUndefined); // filtered = [1, 2, 3] and its type is number[]
Generated using TypeDoc
A utility function that can be used in
.filter
calls to removeundefined
values and assert that the type is not longerundefined
.