panic: Unhandled case in Node.MemberList: KindVariableDeclarationList on merged namespace/enum element access

Aperta
#64,895 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, typescript
Ambito
compilers

Direzione di ricerca

Start by comparing the compiler path that handles merged namespace and enum element access with the related #64668 fix in PR #64746. Reproduce with the provided Foo namespace and enum example, then trace how Node.MemberList handles KindVariableDeclarationList. Done means the compiler no longer panics and reports a type error or handles the case gracefully.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug
🔎 Search Terms

panic Unhandled case Node.MemberList KindVariableDeclarationList merged namespace enum element access

🕗 Version & Regression Information

This changed between versions 6.0.3 and 7.0.2

⏯ Playground Link

No response

💻 Code
namespace Foo { export const BAR = 42; }
enum Foo { BAZ = Foo["BAR"] }
🙁 Actual behavior

tsc panics with:

panic: Unhandled case in Node.MemberList: KindVariableDeclarationList [recovered, repanicked]

The compiler crashes instead of emitting a type error or handling gracefully.

🙂 Expected behavior

tsc should emit a type error (e.g. TS2304 or similar) or
handle the merged namespace/enum case gracefully without crashing.
TypeScript 5.x handles this without panicking.

Additional information about the issue

This is a variant of #64668 (KindModuleBlock panic) but triggered
by export const instead of export class in the namespace.

The fix PR #64746 targets KindModuleBlock it likely does not
cover KindVariableDeclarationList.

Tested on:

  • TypeScript 7.0.2 → panics (KindVariableDeclarationList)
  • TypeScript 5.8.3 → throws JS TypeError (no panic, no crash)
Lingua principale
Go
Stelle
112k
Fork
15.4k
Merge medio
2g 21h
PR unite (30g)
126

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/TypeScript

Tutte le issue di microsoft/TypeScript

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.