2017-05-23 14:44:17 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-05-23 14:44:17 +00:00
|
|
|
*
|
|
|
|
* @flow
|
|
|
|
* @nolint
|
2017-10-31 10:44:59 +00:00
|
|
|
* @format
|
2017-05-23 14:44:17 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* eslint-disable */
|
|
|
|
|
|
|
|
// These annotations are copy/pasted from the built-in Flow definitions and
|
|
|
|
// tweaked so that then() and catch() accept `null` arguments, that they
|
|
|
|
// rightfully do. This should probably be changed in the core lib eventually.
|
|
|
|
declare class Promise<+R> {
|
2017-10-31 10:44:59 +00:00
|
|
|
constructor(
|
|
|
|
callback: (
|
|
|
|
resolve: (result?: Promise<R> | R) => void,
|
|
|
|
reject: (error?: any) => void,
|
|
|
|
) => mixed,
|
2017-12-07 01:25:06 +00:00
|
|
|
): void;
|
2017-05-23 14:44:17 +00:00
|
|
|
|
|
|
|
then<U>(
|
|
|
|
onFulfill?: ?(value: R) => Promise<U> | ?U,
|
2017-10-31 10:44:59 +00:00
|
|
|
onReject?: ?(error: any) => Promise<U> | ?U,
|
2017-12-07 01:25:06 +00:00
|
|
|
): Promise<U>;
|
2017-05-23 14:44:17 +00:00
|
|
|
|
2017-12-07 01:25:06 +00:00
|
|
|
catch<U>(onReject?: (error: any) => ?Promise<U> | U): Promise<U>;
|
2017-05-23 14:44:17 +00:00
|
|
|
|
2017-12-07 01:25:06 +00:00
|
|
|
static resolve<T>(object?: Promise<T> | T): Promise<T>;
|
|
|
|
static reject<T>(error?: mixed): Promise<T>;
|
2017-05-23 14:44:17 +00:00
|
|
|
|
2017-10-31 10:44:59 +00:00
|
|
|
static all<T: Iterable<mixed>>(
|
|
|
|
promises: T,
|
2017-12-07 01:25:06 +00:00
|
|
|
): Promise<$TupleMap<T, typeof $await>>;
|
|
|
|
static race<T>(promises: Array<Promise<T>>): Promise<T>;
|
2017-05-23 14:44:17 +00:00
|
|
|
}
|