microsoft / microsoft/TypeScript
Class member incorrectly stripped from .d.ts output if @internal is mentioned in unrelated comment
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior using the linked TypeScript Playground with stripInternal enabled and the provided class. Trace declaration output handling for consecutive comments, then add a regression test covering an unrelated @internal mention before a separate @internal comment. Done means only shouldBeStripped is omitted while shouldNotBeStripped remains in the .d.ts output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100