Skip to content

Panic with declarationMap in version 7.0.0-dev.20260323.1 #3204

@RohinBhargava

Description

@RohinBhargava

Stack trace

panic: runtime error: slice bounds out of range [1113:912] [recovered, repanicked]

goroutine 30725 [running]:
sync.(*WaitGroup).Go.func1.1()
sync/waitgroup.go:251 +0x48
panic({0x103519980?, 0x7ccfee0a5350?})
runtime/panic.go:860 +0x12c
github.com/microsoft/typescript-go/internal/scanner.SkipTriviaEx({0x7ccfe10b6c00, 0x390}, 0x7cd00dc638c0?, 0x13f?)
github.com/microsoft/typescript-go/internal/scanner/scanner.go:2281 +0x46c
github.com/microsoft/typescript-go/internal/scanner.SkipTrivia(...)
github.com/microsoft/typescript-go/internal/scanner/scanner.go:2266
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitSourceMapsBeforeNode(0x7cd00f6eb500, 0x7cd00dc638c0)
github.com/microsoft/typescript-go/internal/printer/printer.go:5838 +0x114
github.com/microsoft/typescript-go/internal/printer.(*Printer).enterNode(0x7cd00f6eb500, 0x7cd00dc638c0)
github.com/microsoft/typescript-go/internal/printer/printer.go:6056 +0x50
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitImportTypeNode(0x7cd00f6eb500, 0x7cd00dc638c0)
github.com/microsoft/typescript-go/internal/printer/printer.go:2195 +0x28
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitTypeNode(0x7cd00f6eb500, 0x7cd00dc638c0, 0x150707d8?)
github.com/microsoft/typescript-go/internal/printer/printer.go:2315 +0x6bc
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitTypeOperator(0x7cd00f6eb500, 0x7cd0021ccae0)
github.com/microsoft/typescript-go/internal/printer/printer.go:2078 +0x98
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitTypeNode(0x7cd00f6eb500, 0x7cd0021ccae0, 0x1?)
github.com/microsoft/typescript-go/internal/printer/printer.go:2301 +0x528
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitUnionTypeConstituent(0x7cd00f6eb500?, 0x7cd00295db90?)
github.com/microsoft/typescript-go/internal/printer/printer.go:2003 +0x20
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitListItems(0x7cd00f6eb500, 0x103681718, 0x7cd00bfa7c48, {0x7cd0073ad2f0, 0x2, 0x10258f480?}, 0x204, 0x0, {0x1?, 0xbfa7c48?})
github.com/microsoft/typescript-go/internal/printer/printer.go:4917 +0x4c4
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitListRange(0x7cd00f6eb500, 0x103681718, 0x7cd00bfa7c48, 0x7cd00dd9e0e8,
… +118 lines …
ableStatement(0x7cd00f6eb500, 0x7cd00d1f8780)
github.com/microsoft/typescript-go/internal/printer/printer.go:3343 +0x68
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitStatement(0x7cd00d1862a0?, 0x7cd015071a68?)
github.com/microsoft/typescript-go/internal/printer/printer.go:4107 +0x8c
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitListItems(0x7cd00f6eb500, 0x1036816e0, 0x7cd01f337188, {0x7cd00d7d09f0, 0x3, 0x0?}, 0x1, 0x0, {0x1?, 0x15071b08?})
github.com/microsoft/typescript-go/internal/printer/printer.go:4917 +0x4c4
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitListRange(0x7cd00f6eb500, 0x1036816e0, 0x7cd01f337188, 0x7cd019d357e8, 0x1, 0x7cd00dc96400?, 0x7cd015071b68?)
github.com/microsoft/typescript-go/internal/printer/printer.go:4716 +0x310
github.com/microsoft/typescript-go/internal/printer.(*Printer).emitSourceFile(0x7cd00f6eb500, 0x7cd01f337188)
github.com/microsoft/typescript-go/internal/printer/printer.go:4621 +0x21c
github.com/microsoft/typescript-go/internal/printer.(*Printer).Write(0x7cd00f6eb500, 0x7cd01f337188, 0x7cd01f337188, {0x1036a6a90, 0x7cd00d1862a0}, 0x1?)
github.com/microsoft/typescript-go/internal/printer/printer.go:5179 +0xc40
github.com/microsoft/typescript-go/internal/compiler.(*emitter).printSourceFile(0x7cd00c62e4e0, {0x7ccfe178db00, 0x5f}, {0x7ccfe96c48c0, 0x63}, 0x7cd01f337188, 0x7cd00f6eb500, 0x1)
github.com/microsoft/typescript-go/internal/compiler/emitter.go:247 +0x194
github.com/microsoft/typescript-go/internal/compiler.(*emitter).emitDeclarationFile(0x7cd00c62e4e0, 0x7ccfe1642a88, {0x7ccfe178db00, 0x5f}, {0x7ccfe96c48c0, 0x63})
github.com/microsoft/typescript-go/internal/compiler/emitter.go:228 +0x3a4
github.com/microsoft/typescript-go/internal/compiler.(*emitter).emit(0x7cd00c62e4e0)
github.com/microsoft/typescript-go/internal/compiler/emitter.go:48 +0x48
github.com/microsoft/typescript-go/internal/compiler.(*Program).Emit.func2()
github.com/microsoft/typescript-go/internal/compiler/program.go:1541 +0x194
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
github.com/microsoft/typescript-go/internal/core/workgroup.go:40 +0x24
sync.(*WaitGroup).Go.func1()
sync/waitgroup.go:258 +0x48
created by sync.(*WaitGroup).Go in goroutine 1
sync/waitgroup.go:238 +0x70
 ELIFECYCLE  Command failed with exit code 2.

Steps to reproduce

  1. pnpm update --latest
  2. invoke tsgo

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions