convertFunctionToEs6Class: Copy comments from constructor to class (#22738) (#22802)

This commit is contained in:
Andy
2018-03-22 15:15:21 -07:00
committed by GitHub
parent bb89abd7fd
commit cc67601b60
3 changed files with 5 additions and 3 deletions
@@ -49,6 +49,8 @@ namespace ts.codefix {
return undefined;
}
copyComments(ctorDeclaration, newClassDeclaration, sourceFile);
// Because the preceding node could be touched, we need to insert nodes before delete nodes.
changes.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration);
for (const deleteCallback of deletes) {
+1
View File
@@ -225,6 +225,7 @@ namespace ts.textChanges {
return this;
}
/** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */
public deleteNode(sourceFile: SourceFile, node: Node, options: ConfigurableStartEnd = {}) {
const startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart);
const endPosition = getAdjustedEndPosition(sourceFile, node, options);