isAsyncDisposable
function isAsyncDisposable(value): value is AsyncDisposable;Defined in: is-disposable.ts:16
Check if a value has a Symbol.asyncDispose method (async disposable), i.e.
whether it can be bound with await using.
Only objects pass: a function carrying the symbol returns false.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
unknown |
Returns
Section titled “Returns”value is AsyncDisposable
Example
Section titled “Example”import { defer, deferSync, isAsyncDisposable } from "@xtandard/lib";
isAsyncDisposable(defer(() => {})); // trueisAsyncDisposable(deferSync(() => {})); // false (sync only)isAsyncDisposable({ [Symbol.asyncDispose]: async () => {} }); // true