mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
added Parse.Promise catch function
This commit is contained in:
Vendored
+2
@@ -89,6 +89,7 @@ declare namespace Parse {
|
||||
then<U>(resolvedCallback: (...values: T[]) => IPromise<U>, rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
|
||||
then<U>(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
|
||||
then<U>(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise<U>;
|
||||
catch<U>(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise<U>;
|
||||
}
|
||||
|
||||
class Promise<T> implements IPromise<T> {
|
||||
@@ -110,6 +111,7 @@ declare namespace Parse {
|
||||
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
|
||||
then<U>(resolvedCallback: (...values: T[]) => U,
|
||||
rejectedCallback?: (reason: any) => U): IPromise<U>;
|
||||
catch<U>(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise<U>;
|
||||
}
|
||||
|
||||
interface Pointer {
|
||||
|
||||
@@ -514,6 +514,15 @@ function test_promise() {
|
||||
// failed
|
||||
});
|
||||
|
||||
// Test promise with a query
|
||||
const query = new Parse.Query('Test');
|
||||
query.find()
|
||||
.then(() => {
|
||||
// success
|
||||
}).catch(() => {
|
||||
// error
|
||||
});
|
||||
|
||||
// can check whether an object is a Parse.Promise object or not
|
||||
Parse.Promise.is(resolved);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user