From 6a5929328f2ab2360c0c02159201bfee9d7d70ce Mon Sep 17 00:00:00 2001 From: Massimo Hamilton Date: Fri, 16 Dec 2016 09:51:27 +0000 Subject: [PATCH] fix(element): Fix typing of ElementFinder.then --- lib/element.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/element.ts b/lib/element.ts index 3dca28f81..1e8cffa5a 100644 --- a/lib/element.ts +++ b/lib/element.ts @@ -792,7 +792,9 @@ export class ElementArrayFinder extends WebdriverWebElement { export class ElementFinder extends WebdriverWebElement { parentElementArrayFinder: ElementArrayFinder; elementArrayFinder_: ElementArrayFinder; - then: (fn: Function, errorFn?: Function) => wdpromise.Promise = null; + then?: + (fn: (value: any) => any | wdpromise.IThenable, + errorFn?: (error: any) => any) => wdpromise.Promise = null; constructor(public browser_: ProtractorBrowser, elementArrayFinder: ElementArrayFinder) { super(); @@ -806,7 +808,7 @@ export class ElementFinder extends WebdriverWebElement { if (this.parentElementArrayFinder.actionResults_) { // Access the underlying actionResult of ElementFinder. this.then = - (fn: (value: any) => {} | wdpromise.IThenable<{}>, errorFn?: (error: any) => any) => { + (fn: (value: any) => any | wdpromise.IThenable, errorFn?: (error: any) => any) => { return this.elementArrayFinder_.then((actionResults: any) => { if (!fn) { return actionResults[0];