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

0.26 Beta: TS 5.5 @import comments passthrough in declarations to documentation. #2594

Closed
typhonrt opened this issue Jun 15, 2024 · 2 comments
Labels
bug Functionality does not match expectation
Milestone

Comments

@typhonrt
Copy link

Well.. TS 5.5 is almost out along with @import support. What I have noticed in testing is that TSC will retain the @import JSDoc comment blocks when generating declarations from ESM code. In the declarations the correct action import statements are added, but the JSDoc @import comment block is not removed. This can cause minor documentation issues if the next symbol in the declarations doesn't have an associated comment block.. Say a class, or whatever comes next. Here is an example where Test doesn't have a leading comment block (test.d.ts) and thus TypeDoc will pick up the @import comment as associated with Test.

import { TestAlias } from 'test-package';

/**
 * @import { TestAlias } from 'test-package'
 */
declare class Test {}

/**
 * @type {TestAlias}
 */
declare const subTest: TestAlias;

export { subTest, Test };

TypeDoc will treat @import like any other unknown tag and output it:
image


It's a relatively small issue, but one that I'm on the fence whether it is appropriate to post in the Typescript repo, so I'm seeking your opinion. I think all @import only comment blocks can be removed from generated declarations and maybe it's just an oversight from the TS team.

@typhonrt typhonrt added the enhancement Improved functionality label Jun 15, 2024
@Gerrit0 Gerrit0 added bug Functionality does not match expectation and removed enhancement Improved functionality labels Jun 16, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 16, 2024

Well that's annoying, I added code to make TypeDoc ignore @import comments, but I only added it for the file comment parser, I didn't consider the case you described here. This is a bug!

Gerrit0 added a commit that referenced this issue Jun 16, 2024
@Gerrit0 Gerrit0 mentioned this issue Jun 16, 2024
7 tasks
@Gerrit0 Gerrit0 added this to the v0.26.0 milestone Jun 16, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 16, 2024

Fixed with v0.26.0-beta.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants