Skip to content

[🐛 Bug]: wrong type for getValue #15097

@RafalSkorka

Description

@RafalSkorka

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.24.0

Node.js Version

22.21.1

Mode

Standalone Mode

Which capabilities are you using?

What happened?

The type returned by element.getValue function is described as string but the type defined in getValue.d.ts file is unknown:

 * @alias element.getValue
 * @return {String}  requested element(s) value
 * @uses protocol/elements, protocol/elementIdProperty
 *
 */
export declare function getValue(this: WebdriverIO.Element): Promise<unknown>;

This forces me to always use casting:

const range = await someElement.getValue() as string;
const startDate = range.substring(0, 10);

instead of:

const range = await someElement.getValue();
const startDate = range.substring(0, 10);

it was properly defined like this:

export declare function getValue(this: WebdriverIO.Element): Promise<string>;

in 9.20.1.

What is your expected behavior?

No response

How to reproduce the bug.

install the latest webdriverio and use getValue function

Relevant log output

eslint detects it as:

error  Unsafe call of a type that could not be resolved  @typescript-eslint/no-unsafe-call

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions