Improve IntelliSense for commands and script entry point#2476
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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