Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support @extends block tag. #2659

Closed
fiddleplum opened this issue Aug 8, 2024 · 1 comment
Closed

Support @extends block tag. #2659

fiddleplum opened this issue Aug 8, 2024 · 1 comment
Labels
enhancement Improved functionality
Milestone

Comments

@fiddleplum
Copy link

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.

@fiddleplum fiddleplum added the enhancement Improved functionality label Aug 8, 2024
@Gerrit0 Gerrit0 closed this as completed in 48545c1 Aug 9, 2024
@fiddleplum
Copy link
Author

That was amazingly fast, thanks @Gerrit0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

2 participants