Change Parse.Promise to be a class

Also update is, error, as and when method to be static method with corresponding arguments.
This commit is contained in:
Egist Li
2015-10-06 18:31:37 +08:00
parent 05557455c4
commit d5a8570c0b
2 changed files with 19 additions and 6 deletions
+6 -6
View File
@@ -72,14 +72,16 @@ declare namespace Parse {
then<U>(resolvedCallback: (value: T) => U, rejectedCallback?: (reason: any) => U): IPromise<U>;
}
interface Promise<T> {
class Promise<T> {
static as(resolvedValue: any): Promise<any>;
static error(error: any): Promise<any>;
static is(possiblePromise: any): Boolean;
static when(promises: Promise<any>[]): Promise<any>;
always(callback: Function): Promise<T>;
as(): Promise<T>;
done(callback: Function): Promise<T>;
error(): Promise<T>;
fail(callback: Function): Promise<T>;
is(): Promise<T>;
reject(error: any): void;
resolve(result: any): void;
then<U>(resolvedCallback: (value: T) => Promise<U>,
@@ -88,8 +90,6 @@ declare namespace Parse {
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<T>;
then<U>(resolvedCallback: (value: T) => U,
rejectedCallback?: (reason: any) => U): IPromise<T>;
when(promises: Promise<T>[]): Promise<T>;
}
interface IBaseObject {