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

How can I make TranspileCtx return errors on invalid typescript. #14

Open
bubbajoe opened this issue May 19, 2024 · 1 comment
Open

Comments

@bubbajoe
Copy link

bubbajoe commented May 19, 2024

For example, when i try to run this:

export { func: () => { } };

I expect there to be an error because this typescript is not valid, however it just returns invalid javascript.

Compiler Options:

{"alwaysStrict":true,"explainFiles":true,"module":"commonjs","noEmit":true,"noEmitOnError":true,"noErrorTruncation":true,"noLib":true,"target":"es5"}
@clarkmcc
Copy link
Owner

It looks like the Typescript function we use for transpile only returns the output text, not any diagnostics information so this technically isn't a bug.

https://github.com/microsoft/TypeScript/blob/79a851426c514a12a75b342e8dd2460ee6615f73/src/services/transpile.ts#L220

We could consider using the transpileModule function instead but that would be a breaking change so maybe we just make it configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants