mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix the trailing comment emit for module declaration
Fixes #8045 Fixes: - tests\cases\compiler\augmentedTypesClass3.ts - tests\cases\compiler\augmentedTypesModules.ts - tests\cases\compiler\commentsModules.ts
This commit is contained in:
@@ -117,6 +117,25 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const node = range as Node;
|
||||
if (node.kind === SyntaxKind.VariableStatement &&
|
||||
node.original &&
|
||||
node.original.kind === SyntaxKind.ModuleDeclaration) {
|
||||
// Trailing comments for module declaration should be emitted with function closure instead of variable statement
|
||||
// /** Module comment*/
|
||||
// module m1 {
|
||||
// function foo4Export() {
|
||||
// }
|
||||
// } // trailing comment module
|
||||
// Should emit
|
||||
// /** Module comment*/
|
||||
// var m1;
|
||||
// (function (m1) {
|
||||
// function foo4Export() {
|
||||
// }
|
||||
// })(m1 || (m1 = {})); // trailing comment module
|
||||
return undefined;
|
||||
}
|
||||
return getTrailingCommentsOfPosition(range.end);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user