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

Wrong typings for each() method #4634

@inad9300

Description

@inad9300

In Protractor 5.2.2 (and in previous versions too), the typings for the each() method of the ElementArrayFinder class are defined like so:

each(fn: (elementFinder?: ElementFinder, index?: number) => any): wdpromise.Promise<any>;

This is a misunderstanding of TypeScript ? modifier. What you are saying with such a type for fn is that fn may receive 0 arguments, 1 argument or 2 arguments depending on the case. What you want to represent isn't this – each() will every single time receive both elementFinder and index.

This kind of errors are now becoming evident thanks to TypeScript's new --strictFunctionTypes flag, causing a lot of compilation problems.

Many other functions (e.g. map()) contain the same mistake.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions