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];