[Typescript] type definition doesn’t differentiate between sync and async mode #1686

Burgi0101 opened this Issue Nov 3, 2016 · 1 comment


None yet

2 participants

Burgi0101 commented Nov 3, 2016 edited

When using Typescript with WebdriverIO it seems like the type definition doesn't differentiate between sync and async mode and treats everything async.

For example the following code snippet shows a method that should get a text given a locator and afterwards return the text. As we expect to get back a text we define the method to be typeof string.

getItemFromTable(item: string): string {
        return browser.getText(item);


No we face the problem, the method won't work like this as it's treated asynchronous and we do not get back a string yet but instead we get:

WebdriverIO.Client<string | string[]>

So it seems like the type definitions don't differtiate between both modes and treat everything asynchronously.


Using typings from:

  • WebdriverIO version: 4.2.3
  • Node.js version: 3.10.8
  • Standalone mode or wdio testrunner: wdio testrunner
  • Tests: Synchronous
  • Additional wdio packages used:
"wdio-allure-reporter": ">=0.1.1",
"wdio-jasmine-framework": "^0.2.5",
"wdio-json-reporter": ">=0.0.3",
"wdio-junit-reporter": ">=0.1.0",
"wdio-selenium-standalone-service": ">=0.0.5",
"wdio-spec-reporter": ">=0.0.2",
"wdio-teamcity-reporter": "^1.0.2"
@christian-bromann christian-bromann added this to the Upcoming milestone Nov 3, 2016

@Burgi0101 our type definitions just got an update, can you re-check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment