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

emitDeclarationFileOrBundle: allow preserve comments in declaration #31813

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,14 @@ namespace ts {
category: Diagnostics.Basic_Options,
description: Diagnostics.Do_not_emit_comments_to_output,
},
{
name: "preserveDeclarationComments",
type: "boolean",
affectsEmit: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
description: Diagnostics.Preserve_emit_comments_to_output_in_declaration,
},
{
name: "noEmit",
type: "boolean",
Expand Down
6 changes: 5 additions & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4109,6 +4109,10 @@
"category": "Message",
"code": 6502
},
"Preserve emit comments to output in declaration.": {
"category": "Message",
"code": 6503
},

"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
Expand Down Expand Up @@ -4295,7 +4299,7 @@
"Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'.": {
"category": "Error",
"code": 7053
},
},
"No index signature with a parameter of type '{0}' was found on type '{1}'.": {
"category": "Error",
"code": 7054
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ namespace ts {
}

const printerOptions: PrinterOptions = {
removeComments: compilerOptions.removeComments,
removeComments: compilerOptions.removeComments && !compilerOptions.preserveDeclarationComments,
newLine: compilerOptions.newLine,
noEmitHelpers: true,
module: compilerOptions.module,
Expand Down