Skip to content

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

@shlomo100

Description

@shlomo100

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

v16.13.1

Mode

WDIO Testrunner

Which capabilities are you using?

from auto-generated example
TypeScript version: (e.g., 4.9.5)

What happened?

I am encountering an issue related to auto-completion and type prediction for global values such as browser, $, and expect in TypeScript while using WebdriverIO.

Problem:

When typing global values such as browser, $, and expect in my TypeScript files, the auto-completion suggestions do not appear immediately, even though the correct types are recognized. After typing the value and letting it stand, the TypeScript compiler infers the types correctly, but auto-completion does not show the suggestions in real-time.

What is your expected behavior?

I expect that when typing global values like browser, $, and expect, the TypeScript editor should provide immediate auto-completion suggestions based on the recognized types. This behavior is crucial for improving coding efficiency and reducing potential errors.

How to reproduce the bug.

I initiated a new WebdriverIO project using the command npm init wdio . to create a fresh project.

I added the following types setting to my tsconfig.json:

"types": [
  "@wdio/globals/types",
  "node",
  "expect-webdriverio",
  "@wdio/mocha-framework"
]

Upon writing TypeScript code and using global values like browser, $, and expect, I noticed that auto-completion suggestions were not immediately displayed.

However, TypeScript does recognize the correct types for these global values and provides accurate type checking.

Relevant log output

I confirmed that this issue is not specific to my project by creating a fresh WebdriverIO project using "npm init wdio .", 
and the auto-completion issue was still present.
I have tried different approaches, including adjusting tsconfig.json, triple-slash directives, and TypeScript versions, but the auto-completion issue persists.

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

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions