js-util

Home > rc-js-util > promiseRejectNull

promiseRejectNull() function

Returns a Promise of rejection with the supplied error if the value is null or undefined.

Signature:

export declare function promiseRejectNull<T>(value: Promise<T> | T, error: unknown): Promise<Exclude<T, null | undefined>>;

Parameters

Parameter Type Description
value Promise<T> | T  
error unknown  

Returns:

Promise<Exclude<T, null | undefined>>

Remarks

See promiseRejectNull().