@open-condo/miniapp-utils
Version:
A set of helper functions / components / hooks used to build new condo apps fast
11 lines (9 loc) • 391 B
TypeScript
/**
* Checks whenever values is NonNullable.
* From es5 docs NonNullable excludes null and undefined from T
* @example
* const collection: Array<number | null | undefined> = [1, null, 3, undefined, 5]
* const filtered = collection.filter(nonNull) // Array<number>, so it's safe to process it
*/
declare function nonNull<TVal>(val: TVal): val is NonNullable<TVal>;
export { nonNull };