@wpkernel/pipeline / isPromiseLike
Function: isPromiseLike()
Call Signature
ts
function isPromiseLike<T>(value): value is PromiseLike<T>;Tests whether a value exposes a callable then through one ordinary property read. Accessors and proxy traps therefore follow JavaScript's normal semantics and may throw synchronously.
Type Parameters
T
T
Parameters
value
MaybePromise<T>
Candidate synchronous value or thenable.
Returns
value is PromiseLike<T>
true only when that read observes a callable then.
Example
ts
isPromiseLike(Promise.resolve('ready')); // true
isPromiseLike('ready'); // falseCall Signature
ts
function isPromiseLike(value): value is PromiseLike<unknown>;Tests whether a value exposes a callable then through one ordinary property read. Accessors and proxy traps therefore follow JavaScript's normal semantics and may throw synchronously.
Parameters
value
unknown
Candidate synchronous value or thenable.
Returns
value is PromiseLike<unknown>
true only when that read observes a callable then.
Example
ts
isPromiseLike(Promise.resolve('ready')); // true
isPromiseLike('ready'); // false