/** * This is a copypasted declaration from * https://github.com/facebook/flow/blob/master/lib/core.js * with addition of finally method */ declare class Promise<+R> { constructor(callback: ( resolve: (result: Promise | R) => void, reject: (error: any) => void ) => mixed): void; then( onFulfill?: (value: R) => Promise | U, onReject?: (error: any) => Promise | U ): Promise; catch( onReject?: (error: any) => Promise | U ): Promise; static resolve(object: Promise | T): Promise; static reject(error?: any): Promise; static all>(promises: T): Promise<$TupleMap>; static race | T>(promises: Array): Promise; finally( onSettled?: ?(value: any) => Promise | T ): Promise; }