diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4aefa160077..0100f9538bc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6358,7 +6358,9 @@ namespace ts { case SyntaxKind.WhitespaceTrivia: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin const whitespace = scanner.getTokenText(); - if (state === JSDocState.SavingComments || margin !== undefined && indent + whitespace.length > margin) { + if (state === JSDocState.SavingComments) { + comments.push(whitespace); + } else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length;