Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using createProgram outside node environment throws unhelpful exception message #28368

Open
eestein opened this issue Nov 6, 2018 · 0 comments
Labels
API Relates to the public API for TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@eestein
Copy link

eestein commented Nov 6, 2018

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'

@eestein eestein changed the title Using createProgram outside node environment throws unhelpful exception message Using createProgram outside node environment throws unhelpful exception message Nov 6, 2018
@weswigham weswigham added Suggestion An idea for TypeScript In Discussion Not yet reached consensus API Relates to the public API for TypeScript labels Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants