From 6f6324a0ab089f94b8cf0fe2ac07ff8d4786798f Mon Sep 17 00:00:00 2001 From: Git Automerge Date: Fri, 23 Mar 2018 14:59:24 -0500 Subject: [PATCH] added Parse.Promise catch function --- types/parse/index.d.ts | 2 ++ types/parse/parse-tests.ts | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 9f63ed97fb..908281f84d 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -89,6 +89,7 @@ declare namespace Parse { then(resolvedCallback: (...values: T[]) => IPromise, rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; + catch(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; } class Promise implements IPromise { @@ -110,6 +111,7 @@ declare namespace Parse { rejectedCallback?: (reason: any) => IPromise): IPromise; then(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; + catch(resolvedCallback: (...values: T[]) => U, rejectedCallback?: (reason: any) => U): IPromise; } interface Pointer { diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index 60b688ec6e..acb194ed6a 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -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); }