Skip to content

Commit

Permalink
Add finally method to Promise flow definition
Browse files Browse the repository at this point in the history
Summary:
The `finally` method definition was missing, while it really exists causing a flow error when using it.

Added the method definition and make sure flow doesn't throw any error anymore on a real-life example.
Closes #16115

Differential Revision: D6017950

Pulled By: shergin

fbshipit-source-id: 296f3467152eb6eedac817a89cf075e9f906a389
  • Loading branch information
Bhullnatik authored and facebook-github-bot committed Oct 10, 2017
1 parent b9da155 commit 4eccb16
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions flow/Promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ declare class Promise<+R> {
static race<T>(promises: Array<Promise<T>>): Promise<T>;

// Non-standard APIs

// See https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/Promise.native.js#L21
finally<U>(
onFinally?: ?(value: any) => Promise<U> | U
): Promise<U>;

done<U>(
onFulfill?: ?(value: R) => mixed,
onReject?: ?(error: any) => mixed
Expand Down

0 comments on commit 4eccb16

Please sign in to comment.