From 4eccb1693580bba37368e7cfae8de41f08e3af36 Mon Sep 17 00:00:00 2001 From: Jimmy Mayoukou Date: Mon, 9 Oct 2017 21:49:25 -0700 Subject: [PATCH] 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 --- flow/Promise.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flow/Promise.js b/flow/Promise.js index a85abea26..4f6fb3971 100644 --- a/flow/Promise.js +++ b/flow/Promise.js @@ -33,6 +33,12 @@ declare class Promise<+R> { static race(promises: Array>): Promise; // Non-standard APIs + + // See https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/Promise.native.js#L21 + finally( + onFinally?: ?(value: any) => Promise | U + ): Promise; + done( onFulfill?: ?(value: R) => mixed, onReject?: ?(error: any) => mixed