Skip to content

Support @extends block tag. #2659

@fiddleplum

Description

@fiddleplum

Search Terms

extends, javascript, jsdoc, generics

Problem

In my JavaScript code I have this:

/**
 * A viewport is where a scene will be rendered through a camera.
 * @extends {CollectionItem<Engine>}
 */
export class Viewport extends CollectionItem {
  ...
}

I am using JavaScript so I can't put the <Engine> tag directly after the extends CollectionItem, but I am using TypeScript 5.5.4 for validating my JavaScript code, enforcing typing through JSDoc tags everywhere.

When I run my code through TypeDoc 0.26.0, I get the warning:

[warning] Encountered an unknown block tag @extends

However, if I remove it, I get the TypeScript error:

Expected CollectionItem<CollectionParentType> type arguments; provide these with an '@extends' tag.

TypeScript knows I'm running JavaScript with JSDoc and supports it with the --checkJs flag, and I believe you guys support JavaScript with JSDoc as well. I understand that TypeScript itself is your primary target.

TypeScript supports the @extends block tag for its inferring of types, and TypeDoc does not.

Suggested Solution

It would be nice if TypeDoc also supported the @extends tag. It isn't normally needed, except when extending from generic classes where you need to specify the generic parameter.

This came up when I upgraded to 0.56.0, and the extra warnings came up (which fixed some other things for me, thank you!). I searched for an existing issue but did not find one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions