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

TypeScript 2.3 checkJs support #518

Closed
OliverJAsh opened this issue Apr 10, 2017 · 5 comments
Closed

TypeScript 2.3 checkJs support #518

OliverJAsh opened this issue Apr 10, 2017 · 5 comments

Comments

@OliverJAsh
Copy link

I am trying to use the new checkJs flag in TypeScript 2.3. When I run tsc standalone, I get errors from my JS files, however when I run ts-loader, I get no errors from my JS files.

Any idea what might be causing this?

@johnnyreilly
Copy link
Member

Are you using TypeScript 2.3 in your package.json?

@OliverJAsh
Copy link
Author

I am. I checked with yarn list typescript and only 2.3 comes up, so there's definitely not multiple versions of TS.

@OliverJAsh
Copy link
Author

I created a small test case: OliverJAsh/webpack-ts-check-js@c2a5d4e

In this example, the entry file is JS, which depends on a TS file. Transpilation works, but I'm expecting to see typecheck errors (checkJs) and there are none.

I also tried changing the entry file to TS, depending on a JS file. However that also failed to show any typecheck errors.

@schmuli
Copy link
Contributor

schmuli commented Jun 25, 2017

After looking through the source code, and debugging the loader as well, I think I have identified what can be changed to better support JS errors in checkJs mode:

https://github.com/TypeStrong/ts-loader/blob/master/src/after-compile.ts#L129:

Instead of filtering for only [.d.ts, .ts, .tsx], use instance.compilerOptions.checkJs to determine the correct filter to use, similar to how scriptRegex is calculated in https://github.com/TypeStrong/ts-loader/blob/master/src/instances.ts#L97.

@johnnyreilly
Copy link
Member

@schmuli - sounds promising! We welcome PRs 👍 😄

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

3 participants