From 6aa70b2cc5d12e24ea895ba699ef74c5eedfd8f2 Mon Sep 17 00:00:00 2001 From: Derek Cicerone Date: Thu, 23 Jan 2014 15:13:41 -0500 Subject: [PATCH] Add missing error-handling methods * also added the inspect method (https://github.com/cujojs/when/blob/master/docs/api.md#inspect) --- when/when.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/when/when.d.ts b/when/when.d.ts index dbf4050a0f..46a1a12ec7 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -55,11 +55,25 @@ declare module When { } interface Promise { + catch(onRejected?: (reason: any) => Promise): Promise; + catch(onRejected?: (reason: any) => U): Promise; + ensure(onFulfilledOrRejected: Function): Promise; + inspect(): Snapshot; + + otherwise(onRejected?: (reason: any) => Promise): Promise; + otherwise(onRejected?: (reason: any) => U): Promise; + then(onFulfilled: (value: T) => Promise, onRejected?: (reason: any) => Promise, onProgress?: (update: any) => void): Promise; then(onFulfilled: (value: T) => Promise, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise; then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => Promise, onProgress?: (update: any) => void): Promise; then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise; } + + interface Snapshot { + state: string; + value?: T; + reason?: any; + } }