Microsoft/TypeScript
GitHub ã§èŠãClass member incorrectly stripped from .d.ts output if @internal is mentioned in unrelated comment
Open
#57,352 opened on 2024幎2æ9æ¥
Domain: Declaration EmitHelp WantedPossible Improvement
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
internal, .d.ts, stripInternal
ð Version & Regression Information
This issue appears to be present in all version of TypeScript (tested down to 3.3.3).
⯠Playground Link
ð» Code
export class Foo {
/**
* Should be stripped
* @internal
*/
shouldBeStripped = 1;
// TODO: maybe make this @internal?
/**
* Should *not* be stripped
*/
shouldNotBeStripped = 2;
}
ð Actual behavior
The compiler should preserve the Foo.shouldNotBeStripped property while removing Foo.shouldBeStripped.
ð Expected behavior
Both Foo.shouldNotBeStripped and Foo.shouldBeStripped are removed.
Additional information about the issue
If a class member has an unrelated comment mentioning @internal preceding it, TypeScript will drop that member from the .d.ts output, even though that's not the intent since there's another comment after it. Only the first comment should be checked for @internal.