microsoft / microsoft/TypeScript

TypeError: Cannot read properties of undefined (reading 'length') at elaborateDidYouMeanToCallOrConstruct

Aperta
#60,278 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Needs More Info
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

🔎 Search Terms

undefined length elaborateDidYouMeanToCallOrConstruct

🕗 Version & Regression Information
  • This changed between versions 5.5.4 and 5.6.2
  • I was unable to test this on the latest version because npm i typescript@next never completed, spamming the terminal with the following error for about 20 minutes before I killed it:
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: coracle@0.4.14
npm warn Found: typescript@5.7.0-dev.20241018
npm warn node_modules/typescript
npm warn   typescript@"5.7.0-dev.20241018" from the root project
npm warn
npm warn Could not resolve dependency:
npm warn peerOptional typescript@">=5.0.0" from nostr-tools@2.8.1
npm warn node_modules/nostr-tools
npm warn   nostr-tools@"^2.8.1" from the root project
npm warn   4 more (@welshman/content, @welshman/dvm, @welshman/signer, @welshman/util)
⏯ Playground Link

No response

💻 Code

I'm not able to isolate the problem because the compiler is crashing without any information about my source files. You can clone the project from https://github.com/coracle-social/coracle and reproduce simply by running git checkout 5e70d4ed499b6721f41318644b6250713085c923; npm i; npx tsc.

🙁 Actual behavior

Running npx tsc in my project gives me:


/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:120987
      throw e;
      ^

TypeError: Cannot read properties of undefined (reading 'length')
    at elaborateDidYouMeanToCallOrConstruct (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:62406:62)
    at elaborateError (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:62360:10)
    at checkTypeRelatedToAndOptionallyElaborate (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:62344:24)
    at getSignatureApplicabilityError (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:74383:14)
    at resolveCall (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:74779:25)
    at resolveCallExpression (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:75194:12)
    at resolveSignature (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:75587:16)
    at getResolvedSignature (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:75613:18)
    at checkCallExpression (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:75724:23)
    at checkExpressionWorker (/Users/me/nostr/coracle/node_modules/typescript/lib/tsc.js:79133:16)

Node.js v20.18.0

On my Debian 11 VPS, I get a similar error:


/home/me/node_modules/typescript/lib/tsc.js:120986
      throw e;
      ^

TypeError: Cannot read properties of undefined (reading 'length')
    at elaborateDidYouMeanToCallOrConstruct (/home/me/node_modules/typescript/lib/tsc.js:62405:62)
    at elaborateError (/home/me/node_modules/typescript/lib/tsc.js:62360:10)
    at checkTypeRelatedToAndOptionallyElaborate (/home/me/node_modules/typescript/lib/tsc.js:62344:24)
    at getSignatureApplicabilityError (/home/me/node_modules/typescript/lib/tsc.js:74382:14)
    at resolveCall (/home/me/node_modules/typescript/lib/tsc.js:74778:25)
    at resolveCallExpression (/home/me/node_modules/typescript/lib/tsc.js:75193:12)
    at resolveSignature (/home/me/node_modules/typescript/lib/tsc.js:75586:16)
    at getResolvedSignature (/home/me/node_modules/typescript/lib/tsc.js:75612:18)
    at checkCallExpression (/home/me/node_modules/typescript/lib/tsc.js:75723:23)
    at checkExpressionWorker (/home/me/node_modules/typescript/lib/tsc.js:79132:16)

Node.js v18.20.4
🙂 Expected behavior

I expect typescript to not crash.

Additional information about the issue

I completely re-installed nvm/npm/node, removed all node_modules folders on my system, removed the project director and re-cloned, just to make sure my environment wasn't dirty somehow.

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Riproduci il crash dal commit coracle con npm i e npx tsc, quindi confronta TypeScript 5.5.4 e 5.6.2 come descritto. Inizia da elaborateDidYouMeanToCallOrConstruct nello stack trace del compilatore. Il lavoro è completato quando il compilatore segnala una diagnostica o termina senza generare questo TypeError, con copertura di regressione per il riproduttore.

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

Valutazione

Stack tecnologico
node.js, typescript
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.