Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix(element): Fix typing of ElementFinder.then (#3835)
Browse files Browse the repository at this point in the history
Type `then` as optional on ElementFinder.
  • Loading branch information
massimocode authored and juliemr committed Dec 21, 2016
1 parent 9764ea4 commit 4af3b2e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> = null;
then?:
(fn: (value: any) => any | wdpromise.IThenable<any>,
errorFn?: (error: any) => any) => wdpromise.Promise<any> = null;

constructor(public browser_: ProtractorBrowser, elementArrayFinder: ElementArrayFinder) {
super();
Expand All @@ -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<any>, errorFn?: (error: any) => any) => {
return this.elementArrayFinder_.then((actionResults: any) => {
if (!fn) {
return actionResults[0];
Expand Down

0 comments on commit 4af3b2e

Please sign in to comment.