A value which can be iterated asynchronously, it is compatible with the native AsyncIterable type which is only
available when using the ES2018 (or later) lib, so that the exported types can be used without that lib.
When the compiler can use Symbol.asyncIterator as a key (TypeScript v4.3 and later with the ES2018 or later lib)
this contains the [Symbol.asyncIterator] function, so a native AsyncIterable can be assigned to it and vice-versa
and it can be used with for await.
Earlier versions of TypeScript with the ES2018 or later lib define the symbol as a plain symbol which can't be
used as a key, so this is any which can still be assigned to a native AsyncIterable and be used with for await.
As a type guard (isAsyncIterable) for any doesn't narrow, a value declared as a union with AsyncIterable
is not narrowed when the guard is true, and is never when it is false (so check the other types first).
Without the ES2018 or later lib Symbol.asyncIterator is not defined, so this is object.
Type Parameters
T = any
Identifies the type of the values returned by the async iterator
A value which can be iterated asynchronously, it is compatible with the native
AsyncIterabletype which is only available when using the ES2018 (or later) lib, so that the exported types can be used without that lib.Symbol.asyncIteratoras a key (TypeScript v4.3 and later with the ES2018 or later lib) this contains the[Symbol.asyncIterator]function, so a nativeAsyncIterablecan be assigned to it and vice-versa and it can be used withfor await.symbolwhich can't be used as a key, so this isanywhich can still be assigned to a nativeAsyncIterableand be used withfor await. As a type guard (isAsyncIterable) foranydoesn't narrow, a value declared as a union withAsyncIterableis not narrowed when the guard istrue, and isneverwhen it isfalse(so check the other types first).Symbol.asyncIteratoris not defined, so this isobject.