facebook / flow

Adds static typing to JavaScript to improve developer productivity and code quality.
https://flow.org/
MIT License
22.08k stars 1.85k forks source link

yield* an iterable in an async generator function #5491

Closed nicolo-ribaudo closed 3 weeks ago

nicolo-ribaudo commented 6 years ago
async function* fn() {
  yield* [1,2]
}

Flow reports that [1, 2] is not an AsyncIterable https://flow.org/try/#0IYZwngdgxgBAZgV2gFwJYHsICp4QBQCUMA3gFAwxioCmANgCY4DaAjADQBMAuqQL6lA

tinazheng commented 5 years ago

use

async function* fn() {
  yield [1,2]
}
nicolo-ribaudo commented 5 years ago

That's different. My code is the equivalent of

async function* fn() {
  yield 1;
  yield 2;
}
SamChou19815 commented 3 weeks ago

this now works