From 4af3b2e30e925ea9d8e47537ea0a7fe8f04b579d Mon Sep 17 00:00:00 2001 From: Massimo Hamilton Date: Wed, 21 Dec 2016 23:14:04 +0000 Subject: [PATCH] fix(element): Fix typing of ElementFinder.then (#3835) Type `then` as optional on ElementFinder. --- lib/element.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/element.ts b/lib/element.ts index 7d16810b7..bf65e6342 100644 --- a/lib/element.ts +++ b/lib/element.ts @@ -785,7 +785,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(); @@ -799,7 +801,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];