diff --git a/when/when.d.ts b/when/when.d.ts index 62d2cfa0dd..1f71d9ebbd 100644 --- a/when/when.d.ts +++ b/when/when.d.ts @@ -92,28 +92,61 @@ declare module When { } interface Promise { + catch(onRejected?: (reason: any) => Promise): Promise; + catch(onRejected?: (reason: any) => U): Promise; + + catch(filter: (reason: any) => boolean, onRejected?: (reason: any) => Promise): Promise; + catch(filter: (reason: any) => boolean, onRejected?: (reason: any) => U): Promise; + // Make sure you test any usage of these overloads, exceptionType must // be a constructor with prototype set to an instance of Error. catch(exceptionType: any, onRejected?: (reason: any) => Promise): Promise; catch(exceptionType: any, onRejected?: (reason: any) => U): Promise; - catch(filter: (reason: any) => boolean, onRejected?: (reason: any) => Promise): Promise; - catch(filter: (reason: any) => boolean, onRejected?: (reason: any) => U): Promise; - - catch(onRejected?: (reason: any) => Promise): Promise; - catch(onRejected?: (reason: any) => U): Promise; + finally(onFulfilledOrRejected: Function): Promise; ensure(onFulfilledOrRejected: Function): Promise; inspect(): Snapshot; + yield(value: Promise): Promise; + yield(value: U): Promise; + + else(value: T): Promise; + orElse(value: T): Promise; + + tap(onFulfilledSideEffect: (value: T) => void): Promise; + + delay(milliseconds: number): Promise; + + timeout(milliseconds: number, reason?: any): Promise; + + with(thisArg: any): Promise; + withThis(thisArg: any): Promise; + otherwise(onRejected?: (reason: any) => Promise): Promise; otherwise(onRejected?: (reason: any) => U): Promise; + otherwise(predicate: (reason: any) => boolean, onRejected?: (reason: any) => Promise): Promise; + otherwise(predicate: (reason: any) => boolean, onRejected?: (reason: any) => U): Promise; + + // Make sure you test any usage of these overloads, exceptionType must + // be a constructor with prototype set to an instance of Error. + otherwise(exceptionType: any, onRejected?: (reason: any) => Promise): Promise; + otherwise(exceptionType: any, 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; + + done(onFulfilled: (value: T) => void, onRejected?: (reason: any) => void): void; + + fold(combine: (value1: T, value2: V) => Promise, value2: V): Promise; + fold(combine: (value1: T, value2: V) => Promise, value2: Promise): Promise; + + fold(combine: (value1: T, value2: V) => U, value2: V): Promise; + fold(combine: (value1: T, value2: V) => U, value2: Promise): Promise; } interface Thenable {