diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 5affb8a8887..a8dea4ddd0e 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1349,15 +1349,16 @@ namespace ts { const visited = visitEachChild(node, getSynthesizedDeepClone, nullTransformationContext); if (visited === node) { // This only happens for leaf nodes - internal nodes always see their children change. - return getSynthesizedClone(node); + const clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + return clone; } // PERF: As an optimization, rather than calling getSynthesizedClone, we'll update // the new node created by visitEachChild with the extra changes getSynthesizedClone // would have made. - visited.pos = -1; - visited.end = -1; visited.parent = undefined; return visited;