Skip to content

[🐛 Bug]: The error: "Type 'ChainablePromiseArray' must have a '[Symbol.iterator]()' method that returns an iterator.ts(2488) #13923

@tmeisner7

Description

@tmeisner7

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.3.1

Node.js Version

22.11.0

Mode

Standalone Mode

Which capabilities are you using?

const chromeArgs: string[] = [
  // The following commands are needed to resolve the "cannot activate web view" error ---------↓
  '--no-sandbox',
  '--enable-logging',
  '--v=1',
  '--disable-popup-blocking',
  '--disable-notifications',
  '--disable-infobars', 
  '--disable-dev-shm-usage', 
  '--disable-browser-side-navigation', 
  '--disable-gpu',
];

if (process.env.GUI !== 'true') {
  chromeArgs.push('--headless');
}

const capabilities = [
  {
    browserName: 'chrome',
    browserVersion: 'stable',
    'goog:chromeOptions': {
      args: chromeArgs,
    },
    acceptInsecureCerts: true,
  },
];

What happened?

in wdio v8 we had been using the following code as the part of POM and it worked great:

  get btnPanels() {
    return $$('.panel__button');
  }

and then invoked it as:

const panels = await Page.btnPanels;

for (const panel of panels) {
  await expect(panel).toHaveAttr('class', 'false');
}

In wdio v9.3.1 I see the typescript error: "Type 'ChainablePromiseArray' must have a 'Symbol.iterator' method that returns an iterator.ts(2488)" for the panels selector in the loop. I may fix it if I will specify the ChainablePromiseArray return type like this:

  get btnPanels(): ChainablePromiseArray {
    return $$('.panel__button');
  }

What is your expected behavior?

TypeScript should not show error and figure out the type automatically like it did it in the previous version

How to reproduce the bug.

Use code provided above in any IDE editor like VSC in TypeScript project

Relevant log output

no log output

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