-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDuplicateAn existing issue was already createdAn existing issue was already created
Milestone
Description
TS 2.3 RC
{
const iterable: Iterable<number> = {
[Symbol.iterator]: () => 1 as any as Iterator<number>
}
const asyncIterable: AsyncIterable<number> = {
[Symbol.asyncIterator]: () => 1 as any as AsyncIterator<number>
}
class AsyncIterable2 implements AsyncIterable<number> {
[Symbol.asyncIterator] = () => 1 as any as AsyncIterator<number>
}
const asyncIterable2 = new AsyncIterable2()
const gen = async function*(): AsyncIterator<number> {
yield 0;
yield* [1]
yield* iterable
yield* asyncIterable
yield* asyncIterable2 // Error: The type returned by the 'next()' method of an iterator must have a 'value' property.
}
gen()
}I would expect asyncIterable2 to work, but it errors. See code comment above.
I'm using type assertions because the values don't matter so much, just trying to prove the types should fit together.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDuplicateAn existing issue was already createdAn existing issue was already created