Skip to content
Merged
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
3 changes: 3 additions & 0 deletions src/compiler/transformers/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,9 @@ namespace ts {
const varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
errorFallbackNode = undefined;
const statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(SyntaxKind.DeclareKeyword)] : [], factory.createVariableDeclarationList([varDecl], NodeFlags.Const));

preserveJsDoc(statement, input);
removeAllComments(input);
Copy link
Member

Choose a reason for hiding this comment

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

this is probably a question for @rbuckton , but why do you need to removeAllComments(input)? The other uses of preserveJSDoc don't do that.

return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
}
}
Expand Down
22 changes: 22 additions & 0 deletions tests/baselines/reference/exportDefaultExpressionComments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//// [exportDefaultExpressionComments.ts]
/**
* JSDoc Comments
*/
export default null


//// [exportDefaultExpressionComments.js]
"use strict";
exports.__esModule = true;
/**
* JSDoc Comments
*/
exports["default"] = null;


//// [exportDefaultExpressionComments.d.ts]
/**
* JSDoc Comments
*/
declare const _default: any;
export default _default;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/conformance/declarationEmit/exportDefaultExpressionComments.ts ===
/**
No type information for this code. * JSDoc Comments
No type information for this code. */
No type information for this code.export default null
No type information for this code.
No type information for this code.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/conformance/declarationEmit/exportDefaultExpressionComments.ts ===
/**
* JSDoc Comments
*/
export default null
>null : null

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @declaration: true

/**
* JSDoc Comments
*/
export default null