-
Notifications
You must be signed in to change notification settings - Fork 717
Fix declaration emit to remove non-JSDoc comments while preserving JSDoc #1752
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
Merged
jakebailey
merged 12 commits into
main
from
copilot/fix-a7460ee5-0428-460a-bc08-b35e10361567
Sep 26, 2025
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
56f29d9
Initial plan
Copilot 0f81417
Add test case for declaration emit comments preservation issue
Copilot 452d3bc
Implement fix to remove non-JSDoc comments from declaration files
Copilot 2415a29
Complete fix for declaration emit comment preservation with proper JS…
Copilot 7303f69
Accept all baselines after running full test suite - comment handling…
Copilot 25231ff
Fix comment removal approach - always remove all comments first, then…
Copilot d7dbdbe
Fix comment handling in printer for declaration files - remove regula…
Copilot 89c8254
Implement TypeScript-style comment handling: preserveJsDoc + removeAl…
Copilot d06538a
Accept all test baselines - identifies regressions from transformer-b…
Copilot 93d640a
Fix declaration file comment handling: set OnlyPrintJSDocStyle=true f…
Copilot c195d1c
Remove redundant test files and unnecessary comment as requested
Copilot 1400cc0
Merge branch 'main' into copilot/fix-a7460ee5-0428-460a-bc08-b35e1036…
jakebailey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
testdata/baselines/reference/compiler/declarationEmitCommentsPreservation.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//// [tests/cases/compiler/declarationEmitCommentsPreservation.ts] //// | ||
|
||
//// [declarationEmitCommentsPreservation.ts] | ||
// Comment | ||
export class DbObject { | ||
// Comment | ||
id: string = ""; // Comment | ||
// Comment | ||
method() { } | ||
} | ||
|
||
//// [declarationEmitCommentsPreservation.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DbObject = void 0; | ||
// Comment | ||
class DbObject { | ||
// Comment | ||
id = ""; // Comment | ||
// Comment | ||
method() { } | ||
} | ||
exports.DbObject = DbObject; | ||
|
||
|
||
//// [declarationEmitCommentsPreservation.d.ts] | ||
export declare class DbObject { | ||
id: string; | ||
method(): void; | ||
} |
15 changes: 15 additions & 0 deletions
15
testdata/baselines/reference/compiler/declarationEmitCommentsPreservation.symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//// [tests/cases/compiler/declarationEmitCommentsPreservation.ts] //// | ||
|
||
=== declarationEmitCommentsPreservation.ts === | ||
// Comment | ||
export class DbObject { | ||
>DbObject : Symbol(DbObject, Decl(declarationEmitCommentsPreservation.ts, 0, 0)) | ||
|
||
// Comment | ||
id: string = ""; // Comment | ||
>id : Symbol(DbObject.id, Decl(declarationEmitCommentsPreservation.ts, 1, 23)) | ||
|
||
// Comment | ||
method() { } | ||
>method : Symbol(DbObject.method, Decl(declarationEmitCommentsPreservation.ts, 3, 20)) | ||
} |
16 changes: 16 additions & 0 deletions
16
testdata/baselines/reference/compiler/declarationEmitCommentsPreservation.types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//// [tests/cases/compiler/declarationEmitCommentsPreservation.ts] //// | ||
|
||
=== declarationEmitCommentsPreservation.ts === | ||
// Comment | ||
export class DbObject { | ||
>DbObject : DbObject | ||
|
||
// Comment | ||
id: string = ""; // Comment | ||
>id : string | ||
>"" : "" | ||
|
||
// Comment | ||
method() { } | ||
>method : () => void | ||
} |
61 changes: 61 additions & 0 deletions
61
testdata/baselines/reference/compiler/declarationEmitCommentsWithJSDoc.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//// [tests/cases/compiler/declarationEmitCommentsWithJSDoc.ts] //// | ||
|
||
//// [declarationEmitCommentsWithJSDoc.ts] | ||
// Regular comment - should be removed | ||
/** | ||
* JSDoc comment - should be preserved | ||
*/ | ||
export class DbObject { | ||
// Regular comment - should be removed | ||
/** | ||
* JSDoc property comment | ||
*/ | ||
id: string = ""; // Trailing comment - should be removed | ||
|
||
// Regular comment - should be removed | ||
/** | ||
* JSDoc method comment | ||
* @returns void | ||
*/ | ||
method() { } | ||
} | ||
|
||
//// [declarationEmitCommentsWithJSDoc.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DbObject = void 0; | ||
// Regular comment - should be removed | ||
/** | ||
* JSDoc comment - should be preserved | ||
*/ | ||
class DbObject { | ||
// Regular comment - should be removed | ||
/** | ||
* JSDoc property comment | ||
*/ | ||
id = ""; // Trailing comment - should be removed | ||
// Regular comment - should be removed | ||
/** | ||
* JSDoc method comment | ||
* @returns void | ||
*/ | ||
method() { } | ||
} | ||
exports.DbObject = DbObject; | ||
|
||
|
||
//// [declarationEmitCommentsWithJSDoc.d.ts] | ||
/** | ||
* JSDoc comment - should be preserved | ||
*/ | ||
export declare class DbObject { | ||
/** | ||
* JSDoc property comment | ||
*/ | ||
id: string; | ||
/** | ||
* JSDoc method comment | ||
* @returns void | ||
*/ | ||
method(): void; | ||
} |
25 changes: 25 additions & 0 deletions
25
testdata/baselines/reference/compiler/declarationEmitCommentsWithJSDoc.symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//// [tests/cases/compiler/declarationEmitCommentsWithJSDoc.ts] //// | ||
|
||
=== declarationEmitCommentsWithJSDoc.ts === | ||
// Regular comment - should be removed | ||
/** | ||
* JSDoc comment - should be preserved | ||
*/ | ||
export class DbObject { | ||
>DbObject : Symbol(DbObject, Decl(declarationEmitCommentsWithJSDoc.ts, 0, 0)) | ||
|
||
// Regular comment - should be removed | ||
/** | ||
* JSDoc property comment | ||
*/ | ||
id: string = ""; // Trailing comment - should be removed | ||
>id : Symbol(DbObject.id, Decl(declarationEmitCommentsWithJSDoc.ts, 4, 23)) | ||
|
||
// Regular comment - should be removed | ||
/** | ||
* JSDoc method comment | ||
* @returns void | ||
*/ | ||
method() { } | ||
>method : Symbol(DbObject.method, Decl(declarationEmitCommentsWithJSDoc.ts, 9, 20)) | ||
} |
26 changes: 26 additions & 0 deletions
26
testdata/baselines/reference/compiler/declarationEmitCommentsWithJSDoc.types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//// [tests/cases/compiler/declarationEmitCommentsWithJSDoc.ts] //// | ||
|
||
=== declarationEmitCommentsWithJSDoc.ts === | ||
// Regular comment - should be removed | ||
/** | ||
* JSDoc comment - should be preserved | ||
*/ | ||
export class DbObject { | ||
>DbObject : DbObject | ||
|
||
// Regular comment - should be removed | ||
/** | ||
* JSDoc property comment | ||
*/ | ||
id: string = ""; // Trailing comment - should be removed | ||
>id : string | ||
>"" : "" | ||
|
||
// Regular comment - should be removed | ||
/** | ||
* JSDoc method comment | ||
* @returns void | ||
*/ | ||
method() { } | ||
>method : () => void | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
testdata/baselines/reference/submodule/compiler/bigintWithLib.js.diff
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.