Skip to content

JS/TS server: Fix JSDoc return type on generated factories - #871

Merged
travis79 merged 1 commit into
mainfrom
js-server-jsdoc-return-type
Oct 20, 2026
Merged

travis79 merged 1 commit into
mainfrom
js-server-jsdoc-return-type

Conversation

@akkomar

@akkomar akkomar commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

The factory functions' JSDoc hardcoded @returns {EventsServerEventLogger} regardless of ping. For any ping other than events (e.g. server-deletion-request), the factory actually returns a different class, such as ServerDeletionRequestServerEvent, so the JSDoc misled editors and API navigation.

To fix this we'll use the same event_class_name filter as the return new ... line so the documented type always matches the returned class.

Reported by Copilot review on mozilla/fxa#21475.

Pull Request checklist

  • Quality: This PR builds and tests run cleanly
    • make test runs without emitting any warnings
    • make lint runs without emitting any errors
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry to CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to language binding APIs are noted explicitly

The factory functions' JSDoc hardcoded `@returns {EventsServerEventLogger}`
regardless of ping. For any ping other than `events` (e.g.
`server-deletion-request`), the factory actually returns a different class,
such as `ServerDeletionRequestServerEvent`, so the JSDoc misled editors and
API navigation.

Use the same `event_class_name` filter as the `return new ...` line so the
documented type always matches the returned class.

Reported by Copilot review on mozilla/fxa#21475.
@akkomar
akkomar force-pushed the js-server-jsdoc-return-type branch from 56001f1 to f5c2263 Compare October 19, 2026 11:28
@akkomar
akkomar marked this pull request as ready for review October 19, 2026 11:33
@akkomar
akkomar requested a review from a team as a code owner October 19, 2026 11:33
@akkomar
akkomar requested review from jeddai and removed request for a team October 19, 2026 11:33
@travis79
travis79 merged commit d251f2a into main Oct 20, 2026
12 checks passed
@travis79
travis79 deleted the js-server-jsdoc-return-type branch October 20, 2026 14:15
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.

2 participants