microsoft / microsoft/TypeScript
Using createProgram outside node environment throws unhelpful exception message
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
When running createProgram from inside my angular app I'm thrown the 'ts.sys is undefined' error. This error is not helpful since I'm not given the reason for it. It took me a lot of time researching and eventually a question on SO (https://stackoverflow.com/questions/52969177/typescript-createprogram-throwing-ts-sys-is-undefined) to get the answer.
A more elaborate error message would've had been of great help.
TypeScript Version: 3.1.3
Search Terms: 'ts.sys is undefined'
Code
try {
createProgram(Utils.getFileNames(), {
lib: ['lib.es6.d.ts']
// target: ScriptTarget.ES5,
// module: ModuleKind.CommonJS
});
} catch (ex) {
debugger;
}
Expected behavior:
An exception message explaining I should run this code from node environment or pass my own compiler.
Actual behavior:
Throws 'ts.sys is undefined'
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 dal percorso dell’API createProgram e riproduci la chiamata mostrata da un ambiente Angular o da un altro ambiente non-Node. Il lavoro è completato quando l’eccezione spiega che il codice deve essere eseguito in Node o ricevere un compilatore personalizzato, invece di limitarsi a segnalare che ts.sys non è definito.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- api, compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100