From 1f82f368b668585fd94bc0fd4512d90c438c2bbb Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 27 Oct 2026 16:18:00 +0000 Subject: [PATCH] Only pre-size the printer buffer when printing a whole file (#64972) --- tsc/internal/printer/printer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsc/internal/printer/printer.go b/tsc/internal/printer/printer.go index a27452d5147..46bb47c25eb 100644 --- a/tsc/internal/printer/printer.go +++ b/tsc/internal/printer/printer.go @@ -5095,7 +5095,7 @@ func (p *Printer) Write(node *ast.Node, sourceFile *ast.SourceFile, writer EmitT } p.writer = writer p.writer.Clear() - if sourceFile != nil { + if sourceFile != nil && node == sourceFile.AsNode() { if grower, ok := p.writer.(interface{ Grow(n int) }); ok { grower.Grow(len(sourceFile.Text())) }