Skip to content

[🐛 Bug]: TypeScript types for Action.actions is never[] #10797

@JasonWeinzierl

Description

@JasonWeinzierl

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.13.10

Node.js Version

18.17.0

Mode

Standalone Mode

Which capabilities are you using?

No response

What happened?

The TypeScript type for Action.actions is never[].

Because of this, calling driver.performActions is difficult to call with type safety since performActions just accepts object[], and attempting to declare an input array with type Action[] causes TypeScript to error.

What is your expected behavior?

Action should be a useable type when calling performActions, or else performActions should accept a stricter type than just object[].

How to reproduce the bug.

import { Action } from 'webdriverio';

    const actions: Action[] = [
      {
        type: 'key',
        actions: [
          { type: 'keyDown', value: Key.Enter }, // <-- 2 errors here
          { type: 'pause', duration: 2_000 }, // <-- 2 errors here
          { type: 'keyUp', value: Key.Enter }, // <-- 2 errors here
        ],
      },
    ];
    await driver.performActions(actions);

Relevant log output

TypeScript (v5.1.6) errors with:

Type 'string' is not assignable to type 'never'.

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

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions