Skip to content

Tighten types on the mouse and measure surfaces#2479

Merged
soulgalore merged 1 commit into
mainfrom
tighten-mouse-measure-types
May 20, 2026
Merged

Tighten types on the mouse and measure surfaces#2479
soulgalore merged 1 commit into
mainfrom
tighten-mouse-measure-types

Conversation

@soulgalore
Copy link
Copy Markdown
Member

commands.mouse was an anonymous object literal, so every parameter
showed up as any in IntelliSense and hover. Replace the inline
@type {Object} placeholder with a real shape so selector is typed
as string and singleClick's options surface their waitForNavigation
flag instead of any.

measure.stop, clickAndMeasure, and stopAsError were documented
with bare @returns {Promise}, which TypeScript emits as Promise
— that silently masks any downstream assumption about what comes back.
Mark stopAsError as Promise (it returns nothing) and the two
others as Promise so callers have to acknowledge the result
shape rather than inheriting any.

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

Change-Id: I176fd306ee24324f3792663341845b281d9087e0

  commands.mouse was an anonymous object literal, so every parameter
  showed up as any in IntelliSense and hover. Replace the inline
  @type {Object} placeholder with a real shape so selector is typed
  as string and singleClick's options surface their waitForNavigation
  flag instead of any.

  measure.stop, clickAndMeasure, and stopAsError were documented
  with bare @returns {Promise}, which TypeScript emits as Promise<any>
  — that silently masks any downstream assumption about what comes back.
  Mark stopAsError as Promise<void> (it returns nothing) and the two
  others as Promise<unknown> so callers have to acknowledge the result
  shape rather than inheriting any.

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

Change-Id: I176fd306ee24324f3792663341845b281d9087e0
@soulgalore soulgalore merged commit f3fcade into main May 20, 2026
16 checks passed
@soulgalore soulgalore deleted the tighten-mouse-measure-types branch May 20, 2026 07:25
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