Files
tsgo/testdata/baselines/reference/submodule/conformance/awaitUsingDeclarationsWithAsyncIteratorObject.errors.txt

19 lines
904 B
Plaintext

awaitUsingDeclarationsWithAsyncIteratorObject.ts(11,23): error TS2851: The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'.
==== awaitUsingDeclarationsWithAsyncIteratorObject.ts (1 errors) ====
declare const ai: AsyncIterator<string, undefined>;
declare const aio: AsyncIteratorObject<string, undefined, unknown>;
declare const ag: AsyncGenerator<string, void>;
async function f() {
// should pass
await using it0 = aio;
await using it1 = ag;
// should fail
await using it2 = ai;
~~
!!! error TS2851: The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'.
}