Skip to content

feat: support JSDoc @event, @fires, @emits, and @listens tags#800

Merged
littledivy merged 1 commit into
denoland:mainfrom
divybot:feat/jsdoc-event
Jun 2, 2026
Merged

feat: support JSDoc @event, @fires, @emits, and @listens tags#800
littledivy merged 1 commit into
denoland:mainfrom
divybot:feat/jsdoc-event

Conversation

@divybot

@divybot divybot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Adds three new JsDocTag variants to support JSDoc's event-documentation tags so that classes which fire events (e.g. EventTarget subclasses) can be documented with deno doc / on JSR.

Implements:

  • @event <name> — declares an event a class can emit
  • @fires <name> (alias @emits <name>) — documents which events a method/function fires
  • @listens <name> — documents which events a symbol listens for

Names follow the JSDoc convention (e.g. Hurl#snowball, module:hurler~snowball); an optional trailing description is captured into doc.

The new variants are wired into the printer (deno doc terminal output), the tags_same_kind diff helper, and have new serialization and parsing tests.

Example:

/**
 * A connection.
 *
 * @event open - Fired when the connection opens.
 * @event close - Fired when the connection closes.
 */
class Conn extends EventTarget {}

Refs denoland/deno#26697

Adds three new JsDocTag variants for documenting events on classes
that fire or listen for them, e.g. subclasses of EventTarget:

- `@event <name>` — declares an event a class can emit
- `@fires <name>` / `@emits <name>` — documents which events a
  method/function fires
- `@listens <name>` — documents which events a symbol listens for

Names follow the JSDoc convention (e.g. `Hurl#snowball`) and an
optional trailing description is captured into `doc`.

Refs denoland/deno#26697

Co-Authored-By: Divy Srivastava <me@littledivy.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@littledivy littledivy merged commit 01764e5 into denoland:main Jun 2, 2026
4 of 5 checks passed
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.

3 participants