From af9d89e7251afc795f4ed6aa37eeb27a8971231b Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 30 Nov 2015 11:51:47 -0500 Subject: [PATCH] Basing the duck typed Promise interface on es6 --- hapi/hapi.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index fe9e17b5b..b31c24b16 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -17,8 +17,15 @@ declare module "hapi" { [key: string]: T; } - interface IPromise { + interface IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IThenable; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IThenable; + } + interface IPromise extends IThenable { + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => U | IThenable): IPromise; + then(onFulfilled?: (value: R) => U | IThenable, onRejected?: (error: any) => void): IPromise; + catch(onRejected?: (error: any) => U | IThenable): IPromise; } /** Boom Module for errors. https://github.com/hapijs/boom