microsoft / microsoft/TypeScript
Using createProgram outside node environment throws unhelpful exception message
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
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'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the createProgram API path and reproduce the shown call from an Angular or other non-Node environment. Done means the exception explains that the code should run in Node or receive a custom compiler, instead of only reporting that ts.sys is undefined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100