Open DrewciferB opened 2 years ago
PRs welcomed. Note that the types need to support at minimum wdio 6 and 7, in both sync and async modes, as these are all official versions of WebdriverIO.
As you have experienced, I don't believe this is currently done correctly.
@christian-bromann is best positioned to offer insight on how services that add custom commands can provide accurate types for all WDIO versions that have official support.
Until then, you will probably need to modify the types yourself locally. IIRC there are other issues in this repo that have identified issues with this library and typescript.
@tehhowch I don't feel I really understand this anywhere near well enough to contribute, but making the following change at line 60 of wdio-intercept-service/types/wdio-intercept-service.d.ts
removes the problem and allows the project to compile. I tried it in WDIO v6 and v7, in both sync and async mode, and it seems to work. The problem is that I don't understand what's actually going on here, so I don't understand the ramifications of this suggestion (if any):
- type AsyncSync<T> = WebdriverIO.Browser extends WebDriver.Client
+ type AsyncSync<T> = WebdriverIO.Browser extends WebDriver.Capabilities
After making the change, intercept service also seemed to be working normally in all configurations, returning events etc.
@tehhowch @christian-bromann any suggestions?
@DrewciferB can confirm, that patching that line works. Should this be fixed?
@franklinkim I recommend upgrading to v8 where this issue should not persist anymore. Feel free to raise a PR with a fix to the v7
branch in webdriverio/webdriverio
.
@christian-bromann I've upgraded to v8, but it still persists.
Yes and it is quite annoying with typescript :/
facing the same issue in wdio v8
Hi there, I'm getting the following error on compile after updating WDIO to v7. Everything works fine under v6.
It seems that intercept service is defining a type based on an extension of Webdriver.Client, but the global namespace no longer exports Client as an interface in WDIO v7? I admit I'm quite out of my depth here, so apologies if I've missed something basic.
I have Intercept v4.2.1 specified in package.json:
"wdio-intercept-service": "^4.2.1",
Here are my tsconfig.json types
"types": ["node", "webdriverio/sync", "@wdio/mocha-framework", "wdio-intercept-service"]
I notice that the types changed in v7 from
@wdio/sync
towebdriverio/sync
, not sure if that has anything to do with this but the error seems to be happening around code that is concerned with detecting sync mode, so I thought it might be relevant (fromwdio-intercept-service/types/wdio-intercept-service.d.ts
):Even installing a brand new v7 webdriver project into a blank folder and then adding the intercept service still triggered this error, and it also occurs regardless of whether @wdio/sync is installed or not. Any help much appreciated 👍