Add finally method to Promise flow definition

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 https://github.com/facebook/react-native/pull/16115

Differential Revision: D6017950

Pulled By: shergin

fbshipit-source-id: 296f3467152eb6eedac817a89cf075e9f906a389
This commit is contained in:
Jimmy Mayoukou 2017-10-09 21:49:25 -07:00 committed by Facebook Github Bot
parent b9da155fd8
commit 4eccb16935
1 changed files with 6 additions and 0 deletions

View File

@ -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