Skip to content

fix(types): Element and WebdriverIO.Element definitions do not match#11470

Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom
Badisi:patch-1
Oct 19, 2023
Merged

fix(types): Element and WebdriverIO.Element definitions do not match#11470
christian-bromann merged 1 commit intowebdriverio:mainfrom
Badisi:patch-1

Conversation

@Badisi
Copy link
Contributor

@Badisi Badisi commented Oct 19, 2023

Proposed changes

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Was migrating my project from wdio 8.14 to 8.19 and got this blocking issue:

The 'this' context of type 'import("/node_modules/webdriverio/build/types").Element' is not assignable to method's 'this' of type 'WebdriverIO.Element'.
  Type 'Element' is missing the following properties from type 'Element': sessionStatus, sessionNew, sessionEnd, sessionSubscribe, and 25 more.ts(2684)

The problem is that type definition between Element and WebdriverIO.Element are no more in sync.

Reviewers: @webdriverio/project-committers

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. I think initially I thought that bidi commands should be only called from the browser object but I did a quick check and:

const elem = await browser.$('body')
console.log(typeof elem.scriptAddPreloadScriptCommand)

actually prints out function for this one. So make sense to merge this even though it is currently not our desired behavior.

Thanks for the contribution!

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Oct 19, 2023
@christian-bromann christian-bromann merged commit 5027cae into webdriverio:main Oct 19, 2023
@Badisi Badisi deleted the patch-1 branch October 19, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants