microsoft / microsoft/TypeScript

should be able to run typescript under `--frozen-intrinsics`

Aperta
#53,699 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Experience Enhancement Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Bug Report

🔎 Search Terms
  • --frozen-intrinsics
  • Error.stackTraceLimit
  • prototype protection
🕗 Version & Regression Information
  • This is a crash
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______
⏯ Playground Link

Playground link with relevant code

💻 Code
import ts from 'typescript'
console.log(ts.sys.fileExists("reproduce.mjs"))
🙁 Actual behavior
$ node --frozen-intrinsics reproduce.mjs 
(node:239937) ExperimentalWarning: The --frozen-intrinsics flag is experimental
(Use `node --trace-warnings ...` to show where the warning was created)
/path/to/node_modules/typescript/lib/typescript.js:6530
            Error.stackTraceLimit = 0;
                                  ^

TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot assign to read only property 'stackTraceLimit' of function 'function Error() { [native code] }'
    at fileSystemEntryExists (/path/to/node_modules/typescript/lib/typescript.js:6530:35)
    at fileExists (/path/to/node_modules/typescript/lib/typescript.js:6551:20)
    at isFileSystemCaseSensitive (/path/to/node_modules/typescript/lib/typescript.js:6397:21)
    at getNodeSystem (/path/to/node_modules/typescript/lib/typescript.js:6189:45)
    at /path/to/node_modules/typescript/lib/typescript.js:6603:18
    at src/compiler/sys.ts (/path/to/node_modules/typescript/lib/typescript.js:6609:9)
    at __init (/path/to/node_modules/typescript/lib/typescript.js:22:58)
    at src/compiler/_namespaces/ts.ts (/path/to/node_modules/typescript/lib/typescript.js:125073:7)
    at __init (/path/to/node_modules/typescript/lib/typescript.js:22:58)
    at src/typescript/_namespaces/ts.ts (/path/to/node_modules/typescript/lib/typescript.js:169775:7)

Node.js v18.15.0
🙂 Expected behavior
$ node reproduce.mjs 
true
$ node --frozen-intrinsics reproduce.mjs 
true

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 fallimento con node --frozen-intrinsics usando l’esempio reproduce.mjs mostrato, quindi esamina src/compiler/sys.ts intorno a fileSystemEntryExists e la posizione corrispondente in typescript.js. Il lavoro è completato quando l’importazione di TypeScript e la chiamata a ts.sys.fileExists hanno esito positivo con --frozen-intrinsics e restituiscono true come mostrato.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.