Skip to content

Improve IntelliSense for commands and script entry point#2476

Merged
soulgalore merged 1 commit into
mainfrom
improve-script-types
May 20, 2026
Merged

Improve IntelliSense for commands and script entry point#2476
soulgalore merged 1 commit into
mainfrom
improve-script-types

Conversation

@soulgalore
Copy link
Copy Markdown
Member

The high-level helpers added to commands (navigate, find, getText,
fill, hover, press, getTitle, waitForUrl, …) were annotated with
@type {Function}, which overrode the JSDoc @param/@returns and
emitted Function — effectively any — in the generated .d.ts. As a
result, none of those very commands offered parameter completion or
hover info in VS Code.

Removing those annotations lets the existing JSDoc drive the
signature. For the four helpers that bind to a private Measure
method, an explicit @type is added so the public signature is no
longer washed out by the private source.

commands.find now resolves to a real WebElement, so chained calls
on the returned element get completion from selenium-webdriver.

A BrowsertimeScript type alias is exported so users can annotate
their script's default export and get both context and commands
typed in one line, without spelling out the two underlying type
names.

Co-authored-by: Claude noreply@anthropic.com

Change-Id: I1f6f7d9110e5caf695de063745b5d16bef25ab24

  The high-level helpers added to commands (navigate, find, getText,
  fill, hover, press, getTitle, waitForUrl, …) were annotated with
  @type {Function}, which overrode the JSDoc @param/@returns and
  emitted Function — effectively any — in the generated .d.ts. As a
  result, none of those very commands offered parameter completion or
  hover info in VS Code.

  Removing those annotations lets the existing JSDoc drive the
  signature. For the four helpers that bind to a private Measure
  method, an explicit @type is added so the public signature is no
  longer washed out by the private source.

  commands.find now resolves to a real WebElement, so chained calls
  on the returned element get completion from selenium-webdriver.

  A BrowsertimeScript type alias is exported so users can annotate
  their script's default export and get both context and commands
  typed in one line, without spelling out the two underlying type
  names.

  Co-authored-by: Claude noreply@anthropic.com

Change-Id: I1f6f7d9110e5caf695de063745b5d16bef25ab24
@soulgalore soulgalore merged commit 132ee83 into main May 20, 2026
16 checks passed
@soulgalore soulgalore deleted the improve-script-types branch May 20, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant