source: node_modules/es-toolkit/dist/predicate/isNotNil.d.ts@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 662 bytes
Line 
1/**
2 * Checks if the given value is not null nor undefined.
3 *
4 * The main use of this function is to be used with TypeScript as a type predicate.
5 *
6 * @template T - The type of value.
7 * @param {T | null | undefined} x - The value to test if it is not null nor undefined.
8 * @returns {x is T} True if the value is not null nor undefined, false otherwise.
9 *
10 * @example
11 * // Here the type of `arr` is (number | undefined)[]
12 * const arr = [1, undefined, 3];
13 * // Here the type of `result` is number[]
14 * const result = arr.filter(isNotNil);
15 * // result will be [1, 3]
16 */
17declare function isNotNil<T>(x: T | null | undefined): x is T;
18
19export { isNotNil };
Note: See TracBrowser for help on using the repository browser.