isAsyncGenerator
Checks if a value is an async generator object (the result of calling an async function*).
Distinct from isAsyncGeneratorFunction: this predicate targets the instance produced by calling an async generator function, not the function itself.
Available since v2.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is AsyncGenerator<unknown, unknown, unknown> — true if value is an AsyncGenerator instance
Examples
Section titled “Examples”Detect an async generator instance
Section titled “Detect an async generator instance”Returns true only for the object produced by calling an async function*.
Distinguish async from sync generators
Section titled “Distinguish async from sync generators”isAsyncGenerator is false for sync generator instances.
