Skip to content

(@wdio/globals): fix type propagation#11022

Merged
christian-bromann merged 5 commits intomainfrom
cb-fix-global-types
Sep 13, 2023
Merged

(@wdio/globals): fix type propagation#11022
christian-bromann merged 5 commits intomainfrom
cb-fix-global-types

Conversation

@christian-bromann
Copy link
Member

Proposed changes

fixes #11020

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

n/a

Reviewers: @webdriverio/project-committers

@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Aug 28, 2023
@shlomo100
Copy link

In light of the upcoming correction, it will be necessary to update the library documentation to reflect the refined approach for importing global types. This new method leverages the @wdio/globals package, which interfaces through the /build/index.d.ts file.

Furthermore, please direct your attention to the specific section within the package.json file, labeled "exports"

"exports": { ".": [ { "types": "./build/index.d.ts", "import": "./build/index.js", "require": "./cjs/index.js" }, "./cjs/index.js" ], // ... other export entries }

I appreciate your attention to these updates and thank you for your commitment to enhancing the overall quality of the library.

@erwinheitzman
Copy link
Member

Will test this locally, thanks :)

@erwinheitzman
Copy link
Member

@shlomo100 I have tested the change locally which seems to work fine, can you share what you meant by your previous message? As I'm not sure what you mean by checking the exports and changing the docs.

@shlomo100
Copy link

@erwinheitzman @christian-bromann
Thanks for the fix! I've tested it in the current version, and it works as expected. It's important to highlight that without adding the following line to the tsconfig file:

"types": [
    "@wdio/globals"
]

The automatic completion of the browser global values won't function properly. This adjustment is essential for full functionality. Great job on the fix!

@erwinheitzman
Copy link
Member

Yes but this is a requirement anyway so no further changes are needed :)

@christian-bromann christian-bromann merged commit f11556a into main Sep 13, 2023
@christian-bromann christian-bromann deleted the cb-fix-global-types branch September 13, 2023 16:50
@@ -1,4 +1,4 @@
import '../types.d.ts'
/// <reference path="../types.d.ts" />

Choose a reason for hiding this comment

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

@christian-bromann I see that in the end this part did not come up in the patch for the latest version, why? This is what makes patching work and make types work

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what makes patching work and make types work

I don't think so. If you create a new WebdriverIO project through npm init wdio . you will see that types are propagated correctly if the setup follows our configuration recommendation. Please provide a reproducible example if you don't get this.

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.

[🐛 Bug]: Auto-Completion and Type Prediction Issue for Global Values (e.g., browser, $, expect) in TypeScript on v8 with intelij

3 participants