Skip to content

Crash when compiling @types/google.maps #1166

@mpk

Description

@mpk

In today's nightly (7.0.0-dev.20250611.1), I encountered a crash when trying to compile my application. The crash seems to be caused by files containing JSDoc comments, for example @types/google.maps/index.d.ts.

I did a quick bisect and this is the commit after which the compiler starts to crash.

Steps to reproduce:

npm install @typescript/native-preview @types/google.maps
npx tsgo --noEmit ./node_modules/@types/google.maps/index.d.ts

Crash:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x104af3078]

goroutine 38 [running]:
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkGrammarClassDeclarationHeritageClauses(0x1400118f008, 0x140000b13b0, 0x14000021688)
        github.com/microsoft/typescript-go/internal/checker/grammarchecks.go:934 +0x348
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkGrammarClassLikeDeclaration(0x1400118f008, 0x104b4ccbc?)
        github.com/microsoft/typescript-go/internal/checker/grammarchecks.go:782 +0x74
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkClassLikeDeclaration(0x1400118f008, 0x140000b13b0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:4066 +0x2c
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkClassDeclaration(0x1400118f008, 0x140000b13b0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:4060 +0x114
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElementWorker(0x1400118f008, 0x140000b13b0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2250 +0x2e8
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElement(0x1400118f008, 0x104bbafa0?)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2144 +0x50
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElements(0x1400118f008, {0x140008b6008, 0xcc, 0x104bbaedc?})
        github.com/microsoft/typescript-go/internal/checker/checker.go:2135 +0x34
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkBlock(0x1400118f008, 0x140008fcfa0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:3576 +0x130
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElementWorker(0x1400118f008, 0x140008fcfa0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2214 +0x308
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElement(0x1400118f008, 0x1400038e070?)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2144 +0x50
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkModuleDeclaration(0x1400118f008, 0x14000162510)
        github.com/microsoft/typescript-go/internal/checker/checker.go:4876 +0x64
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElementWorker(0x1400118f008, 0x14000162510)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2260 +0x300
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElement(0x1400118f008, 0x104764a44?)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2144 +0x50
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkModuleDeclaration(0x1400118f008, 0x140001625a0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:4876 +0x64
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElementWorker(0x1400118f008, 0x140001625a0)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2260 +0x300
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElement(0x1400118f008, 0xc?)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2144 +0x50
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceElements(0x1400118f008, {0x14000ac08f8, 0xc, 0x140000960a0?})
        github.com/microsoft/typescript-go/internal/checker/checker.go:2135 +0x34
github.com/microsoft/typescript-go/internal/checker.(*Checker).checkSourceFile(0x1400118f008, {0x104fc9b08, 0x1054e76e0}, 0x14000021688)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2107 +0xfc
github.com/microsoft/typescript-go/internal/checker.(*Checker).CheckSourceFile(0x1400118f008, {0x104fc9b08, 0x1054e76e0}, 0x14000021688)
        github.com/microsoft/typescript-go/internal/checker/checker.go:2096 +0x64
github.com/microsoft/typescript-go/internal/compiler.(*Program).CheckSourceFiles.func1-range1(0x140000f8f38?)
        github.com/microsoft/typescript-go/internal/compiler/program.go:331 +0x4c
github.com/microsoft/typescript-go/internal/compiler.(*checkerPool).Files.func1(0x14000f63a10)
        github.com/microsoft/typescript-go/internal/compiler/checkerpool.go:82 +0x84
github.com/microsoft/typescript-go/internal/compiler.(*Program).CheckSourceFiles.func1()
        github.com/microsoft/typescript-go/internal/compiler/program.go:330 +0xdc
github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
        github.com/microsoft/typescript-go/internal/core/workgroup.go:39 +0x5c
created by github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue in goroutine 1
        github.com/microsoft/typescript-go/internal/core/workgroup.go:37 +0x84

Environment:

macOS 15.3.1
Node 22.13.0

Metadata

Metadata

Assignees

Labels

CrashDomain: JSRelated to JS parsing, checkingDomain: Type CheckingRelated to type checking, grammar checking

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions