Skip to content

[🐛 Bug]: Unable to use DataTable class imported from @wdio/cucumber-framework after migration to WDIO v8 #11355

@NaZaRKIN123

Description

@NaZaRKIN123

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

"@wdio/cucumber-framework": "^8.16.19"

Node.js Version

v18.12.1

Mode

WDIO Testrunner

Which capabilities are you using?

No response

What happened?

I'm trying to migrate from WDIO 7 to WDIO 8, and getting a TS error "'DataTable' refers to a value, but is being used as a type here. Did you mean 'typeof DataTable'?ts(2749)".

What is your expected behavior?

DataTable to be used as type parameter without errors

How to reproduce the bug.

The below code will show two TS errors:

  1. 'DataTable' is declared but its value is never read.ts(6133)
  2. 'DataTable' refers to a value, but is being used as a type here. Did you mean 'typeof DataTable'?ts(2749)
import { DataTable, When } from '@wdio/cucumber-framework'
When(/test/, async (table: DataTable) => {
    const rows = table.rows()
})

tsconfig.json

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "allowJs": false,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "checkJs": false,
    "moduleResolution": "node",
    "types": [
      "node",
      "@wdio/globals/types",
      "@wdio/cucumber-framework",
      "expect-webdriverio",
      "wdio-intercept-service",
      "mocha",
    ],
    "target": "ES2022",
    "lib": [
      "ES2022"
    ],
    "noImplicitAny": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "noImplicitOverride": true,
    "noFallthroughCasesInSwitch": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noEmit": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "strict": true
  },
  "include": [
    "src",
  ],
  "exclude": [
    "node_modules",
  ]
}

Relevant log output

not applicable

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