microsoft / microsoft/TypeScript
compilerOptions support TDZ error option
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
According to the PR of #32221 , to prevent such problem like:
(function () {
function cleanup() {
console.log(A); // throw error
}
cleanup();
const A = 1;
}());
this snippet will compile into:
(function () {
function cleanup() {
console.log(A); // log undefined
}
cleanup();
var A = 1;
}());
Error in the first snippet will be ignored, and cause TDZ error. Can tsc support TDZ error enabled option like babel-plugin-transform-block-scoping ? It will notify peoples who write such pattern to prevent further weird problems.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia leggendo gli esempi TypeScript e JavaScript dell'issue e la PR #32221 indicata. Chiarisci come un'opzione del compilatore dovrebbe segnalare i pattern di temporal dead zone e quali diagnostica dovrebbe produrre; il lavoro è completo quando l'opzione proposta è definita abbastanza chiaramente da poter essere implementata e validata senza modificare l'output esistente per impostazione predefinita.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100