Skip to content

Conversation

@jakebailey
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings December 8, 2025 06:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports the --stripInternal compiler option from TypeScript, which removes declarations marked with @internal JSDoc comments from emitted declaration files. The implementation correctly identifies internal annotations in both regular declarations and constructor parameter properties.

Key Changes

  • Adds stripInternal flag to SymbolTrackerSharedState for tracking the compiler option
  • Implements shouldStripInternal(), isInternalDeclaration(), and hasInternalAnnotation() methods for detecting internal declarations
  • Applies internal stripping at key transformation points: declaration subtrees, statements, top-level declarations, constructor parameter properties, and enum members

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/transformers/declarations/transform.go Core implementation of stripInternal feature with detection logic for @internal annotations and integration into the declaration transformation pipeline
internal/transformers/declarations/tracker.go Adds stripInternal boolean field to shared state for tracking the compiler option
testdata/baselines/reference/submodule/conformance/declarationEmitWorkWithInlineComments.js Updated baseline showing correct removal of internal constructor parameter properties from declaration output
testdata/baselines/reference/submodule/conformance/declarationEmitWorkWithInlineComments.js.diff Reduced diff indicating convergence with reference TypeScript implementation
testdata/baselines/reference/submodule/compiler/stripInternal1.js Updated baseline showing correct removal of internal method declarations
testdata/baselines/reference/submodule/compiler/stripInternal1.js.diff Eliminated diff indicating complete convergence with reference implementation

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; I thought the builder had something special for stripInternal, but maybe the affectsBuildInfo flag on the option is sufficient.

@jakebailey jakebailey added this pull request to the merge queue Dec 8, 2025
@weswigham
Copy link
Member

I've also noticed that, weirdly, 7.0 will actually have better --stripInternal support in JS than 6.0, because in 7.0, JS goes through the normal declaration emitter instead of the node builder, so @internal is respected in JS declaration emit now.

@jakebailey
Copy link
Member Author

Yay better architecutre!

Merged via the queue into main with commit d876d05 Dec 8, 2025
29 checks passed
@jakebailey jakebailey deleted the jabaile/strip-internal branch December 8, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants