198 lines
15 KiB
Plaintext
198 lines
15 KiB
Plaintext
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(2,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(8,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(10,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterableIterator<number>'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(13,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterableIterator<number>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(16,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterableIterator<number>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(19,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterable<number>'.
|
|
Types of property '[Symbol.asyncIterator]' are incompatible.
|
|
Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
Types of property 'next' are incompatible.
|
|
Type '(value?: any) => Promise<IteratorResult<string>>' is not assignable to type '(value?: any) => Promise<IteratorResult<number>>'.
|
|
Type 'Promise<IteratorResult<string>>' is not assignable to type 'Promise<IteratorResult<number>>'.
|
|
Type 'IteratorResult<string>' is not assignable to type 'IteratorResult<number>'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(22,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterable<number>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(25,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterable<number>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(28,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(31,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(34,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(38,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(41,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(44,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(47,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(50,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(53,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(56,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(59,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(62,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(64,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'IterableIterator<number>'.
|
|
Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator<any>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(67,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterable<number>'.
|
|
Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator<any>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(70,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterator<number>'.
|
|
Types of property 'next' are incompatible.
|
|
Type '(value?: any) => Promise<IteratorResult<any>>' is not assignable to type '(value?: any) => IteratorResult<number>'.
|
|
Type 'Promise<IteratorResult<any>>' is not assignable to type 'IteratorResult<number>'.
|
|
Property 'done' is missing in type 'Promise<IteratorResult<any>>'.
|
|
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(74,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
|
|
|
|
|
==== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts (24 errors) ====
|
|
async function * inferReturnType1() {
|
|
yield* {};
|
|
~~
|
|
!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
|
}
|
|
async function * inferReturnType2() {
|
|
yield* inferReturnType2();
|
|
}
|
|
async function * inferReturnType3() {
|
|
yield* Promise.resolve([1, 2]);
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
|
}
|
|
const assignability1: () => AsyncIterableIterator<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterableIterator<number>'.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
yield "a";
|
|
};
|
|
const assignability2: () => AsyncIterableIterator<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterableIterator<number>'.
|
|
yield* ["a", "b"];
|
|
};
|
|
const assignability3: () => AsyncIterableIterator<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterableIterator<number>'.
|
|
yield* (async function * () { yield "a"; })();
|
|
};
|
|
const assignability4: () => AsyncIterable<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterable<number>'.
|
|
!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible.
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
!!! error TS2322: Types of property 'next' are incompatible.
|
|
!!! error TS2322: Type '(value?: any) => Promise<IteratorResult<string>>' is not assignable to type '(value?: any) => Promise<IteratorResult<number>>'.
|
|
!!! error TS2322: Type 'Promise<IteratorResult<string>>' is not assignable to type 'Promise<IteratorResult<number>>'.
|
|
!!! error TS2322: Type 'IteratorResult<string>' is not assignable to type 'IteratorResult<number>'.
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
yield "a";
|
|
};
|
|
const assignability5: () => AsyncIterable<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterable<number>'.
|
|
yield* ["a", "b"];
|
|
};
|
|
const assignability6: () => AsyncIterable<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterable<number>'.
|
|
yield* (async function * () { yield "a"; })();
|
|
};
|
|
const assignability7: () => AsyncIterator<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
yield "a";
|
|
};
|
|
const assignability8: () => AsyncIterator<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
yield* ["a", "b"];
|
|
};
|
|
const assignability9: () => AsyncIterator<number> = async function * () {
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
|
!!! error TS2322: Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
|
yield* (async function * () { yield "a"; })();
|
|
};
|
|
async function * explicitReturnType1(): AsyncIterableIterator<number> {
|
|
yield "a";
|
|
~~~
|
|
!!! error TS2322: Type '"a"' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType2(): AsyncIterableIterator<number> {
|
|
yield* ["a", "b"];
|
|
~~~~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType3(): AsyncIterableIterator<number> {
|
|
yield* (async function * () { yield "a"; })();
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType4(): AsyncIterable<number> {
|
|
yield "a";
|
|
~~~
|
|
!!! error TS2322: Type '"a"' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType5(): AsyncIterable<number> {
|
|
yield* ["a", "b"];
|
|
~~~~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType6(): AsyncIterable<number> {
|
|
yield* (async function * () { yield "a"; })();
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType7(): AsyncIterator<number> {
|
|
yield "a";
|
|
~~~
|
|
!!! error TS2322: Type '"a"' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType8(): AsyncIterator<number> {
|
|
yield* ["a", "b"];
|
|
~~~~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType9(): AsyncIterator<number> {
|
|
yield* (async function * () { yield "a"; })();
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
}
|
|
async function * explicitReturnType10(): IterableIterator<number> {
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'IterableIterator<number>'.
|
|
!!! error TS2322: Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator<any>'.
|
|
yield 1;
|
|
}
|
|
async function * explicitReturnType11(): Iterable<number> {
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterable<number>'.
|
|
!!! error TS2322: Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator<any>'.
|
|
yield 1;
|
|
}
|
|
async function * explicitReturnType12(): Iterator<number> {
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterator<number>'.
|
|
!!! error TS2322: Types of property 'next' are incompatible.
|
|
!!! error TS2322: Type '(value?: any) => Promise<IteratorResult<any>>' is not assignable to type '(value?: any) => IteratorResult<number>'.
|
|
!!! error TS2322: Type 'Promise<IteratorResult<any>>' is not assignable to type 'IteratorResult<number>'.
|
|
!!! error TS2322: Property 'done' is missing in type 'Promise<IteratorResult<any>>'.
|
|
yield 1;
|
|
}
|
|
async function * yieldStar() {
|
|
yield* {};
|
|
~~
|
|
!!! error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
|
} |