From 03e2484c40756cf0d1e7a6dee2ee5f07def2c9c3 Mon Sep 17 00:00:00 2001 From: Kaido Iwamoto Date: Wed, 10 May 2023 17:03:19 +0900 Subject: [PATCH] fix: fix manipulation (related to #1409) --- packages/ts-morph/src/manipulation/nodeHandlers/RangeHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ts-morph/src/manipulation/nodeHandlers/RangeHandler.ts b/packages/ts-morph/src/manipulation/nodeHandlers/RangeHandler.ts index 1f33c6ca5..e2ddbc62e 100644 --- a/packages/ts-morph/src/manipulation/nodeHandlers/RangeHandler.ts +++ b/packages/ts-morph/src/manipulation/nodeHandlers/RangeHandler.ts @@ -56,7 +56,7 @@ export class RangeHandler implements NodeHandler { newNodeChildren.next(); // handle the rest - while (!currentNodeChildren.done) + while (!currentNodeChildren.done && !newNodeChildren.done) this.straightReplace(currentNodeChildren.next(), newNodeChildren.next(), newSourceFile); // ensure the new children iterator is done too