Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Fable.Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* [Python] Added collection protocol markers and interfaces for Python interop (by @dbrattli)
* [JS] Add `AsyncIterator`, `AsyncGenerator`, and `IteratorResult` interfaces for the AsyncIterator protocol (by @Lanayx)

### Fixed

Expand Down
16 changes: 16 additions & 0 deletions src/Fable.Core/Fable.Core.JS.fs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,22 @@ module JS =
and [<AllowNullLiteral>] AsyncIterable<'T> =
inherit AsyncIterable

[<Emit("$0[Symbol.asyncIterator]()")>]
abstract asyncIterator: unit -> AsyncIterator<'T>

and [<AllowNullLiteral>] IteratorResult<'T> =
abstract value: 'T with get, set
abstract ``done``: bool with get, set

and [<AllowNullLiteral>] AsyncIterator<'T> =
abstract next: unit -> Promise<IteratorResult<'T>>
abstract ``return``: value: 'T -> Promise<IteratorResult<'T>>
abstract throw: e: obj -> Promise<IteratorResult<'T>>

and [<AllowNullLiteral>] AsyncGenerator<'T> =
inherit AsyncIterator<'T>
inherit AsyncIterable<'T>

and [<AllowNullLiteral>] Promise<'T> =
abstract ``then``: ?onfulfilled: ('T -> 'TResult) * ?onrejected: (obj -> 'TResult) -> Promise<'TResult>

Expand Down
Loading