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

Commit 4af3b2e

Browse files
massimocodejuliemr
authored andcommitted
fix(element): Fix typing of ElementFinder.then (#3835)
Type `then` as optional on ElementFinder.
1 parent 9764ea4 commit 4af3b2e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/element.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,9 @@ export class ElementArrayFinder extends WebdriverWebElement {
785785
export class ElementFinder extends WebdriverWebElement {
786786
parentElementArrayFinder: ElementArrayFinder;
787787
elementArrayFinder_: ElementArrayFinder;
788-
then: (fn: Function, errorFn?: Function) => wdpromise.Promise<any> = null;
788+
then?:
789+
(fn: (value: any) => any | wdpromise.IThenable<any>,
790+
errorFn?: (error: any) => any) => wdpromise.Promise<any> = null;
789791

790792
constructor(public browser_: ProtractorBrowser, elementArrayFinder: ElementArrayFinder) {
791793
super();
@@ -799,7 +801,7 @@ export class ElementFinder extends WebdriverWebElement {
799801
if (this.parentElementArrayFinder.actionResults_) {
800802
// Access the underlying actionResult of ElementFinder.
801803
this.then =
802-
(fn: (value: any) => {} | wdpromise.IThenable<{}>, errorFn?: (error: any) => any) => {
804+
(fn: (value: any) => any | wdpromise.IThenable<any>, errorFn?: (error: any) => any) => {
803805
return this.elementArrayFinder_.then((actionResults: any) => {
804806
if (!fn) {
805807
return actionResults[0];

0 commit comments

Comments
 (0)