Skip to content

Improve MDN JSDoc wording - less wordy #29748

@mihailik

Description

@mihailik

Search Terms

MDN JSDoc

Suggestion

A recent boost to dom.generated.d.ts #29690 brought in tons of MDN docs, which is super-helpful.

However, MDN format is well fit for Jane Austen, if not Mervyn Peake. For though sophisticated and corteous, 'tis not entirely fit for short form that is IDE tooltips and completions.

Perhaps, a fair bit of creative massaging can cut the introductions to a minimum?

The first thing to remove are introductions, repeating the name of the symbol, its type and various pocket lint words like 'this' 'represents' and so on.


I would suggest scrolling through the JSDocs added in PR DOM update February 2019 #29690 and making a set of 20-30 regex-assisted context-aware string replacers.

Then run DOM update scripts again with those, after which scroll through the JSDocs and nitpick if anything still needs tweaking. Hopefully not!

Next time DOM update is run, use those existing massaging string replacers, so the .d.ts stays lean and hungry.

Use Cases

IDE light-up features: tooltips, completions, signature tips.

Examples

/** The AudioTrack interface represents a single audio... more... wait... this text... is actually... what docs are for, not the intro at the start... why is it replaced... with ellipsis... ah I know, it's because that's how human perception works... it favours the start of the long paragraph... and of the HTML media elements, <audio> or <video>. .  */
interface AudioTrack {

Replace with:

/** A single audio track from one of the HTML media elements, <audio> or <video>.  */
interface AudioTrack {

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions