@xylabs/exists
Version:
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
10 lines • 461 B
TypeScript
/**
* Used to type narrow an object which is possibly null or undefined. Works well
* with functional Array methods. For example:
* @example
* const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []
* @param x The object which is potentially undefined or null
* @returns False if the object is null/undefined, true otherwise
*/
export declare const exists: <T>(x?: T | null) => x is NonNullable<T>;
//# sourceMappingURL=index.d.ts.map