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

fix transpileOnly usage with fork-ts-checker #1173

Closed
wants to merge 1 commit into from

Conversation

desmap
Copy link

@desmap desmap commented Aug 26, 2020

docs are wrong: transpileOnly: true paired with fork-ts-checker together turns off type-checking entirely; just fork-ts-checker is sufficient

Copy link
Member

@johnnyreilly johnnyreilly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand your edit here I'm afraid; setting transpileOnly: true is a ts-loader option only and should have no effect upon the behaviour of the fork-ts-checker-webpack-plugin.

@desmap
Copy link
Author

desmap commented Aug 26, 2020

hey @johnnyreilly,

should have no effect upon the behaviour of the fork-ts-checker-webpack-plugin.

this is also what I don't get and in my prior apps I assumed exactly what you write.

But when I was benchmarking I found that type checking was turned off if you have both transpileOnly: true ("tO") in the ts-loader options and fork-ts-checker ("ftsc") as plugin enabled. I tested this multiple times with deliberate type errors. Also look at my benchmarks at the two different versions: The tO + ftsc was as fast as the pure tO version and faster than the pure ftsc version. Test it yourself.

@desmap
Copy link
Author

desmap commented Aug 26, 2020

just tested again and added a type error to one of the 1,000 functions:

(param: string) => {
  const extraError: number = param
  console.log(extraError)
}

CASE A transpileOnly: true in ts-loader options + fork-ts-checker enabled:

Entrypoint main = runtime~main.js main.js
[./client/index.tsx] 89.5 KiB {main} [built]
    + 47 hidden modules
ℹ 「wdm」: Compiled successfully.
No issues found.

CASE B just fork-ts-checker enabled:

Entrypoint main = runtime~main.js main.js
[./client/index.tsx] 89.5 KiB {main} [built] [1 error]
    + 47 hidden modules

ERROR in [...]/client/index.tsx
./client/index.tsx
[tsl] ERROR in [...]/client/index.tsx(4003,11)
      TS2322: Type 'string' is not assignable to type 'number'.
ℹ 「wdm」: Failed to compile.

CC @appzuka

Edit: i have projectReference: true and fwiw, I added the type error to a non-reference/main file.
Edit2: i just added the type error instead to a reference file and type errors are emitted with CASE A and CASE B

@johnnyreilly
Copy link
Member

Edit: i have projectReference: true

This seems significant. Do you want to repeat your test in a non-project references context. I suspect that's what's causing your issue.

@desmap
Copy link
Author

desmap commented Aug 26, 2020

I did already in Edit2 and in this probably related thread: #1158 (comment)

@desmap
Copy link
Author

desmap commented Aug 26, 2020

Ok then this pull is obsolete and it's something different, closing

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

Successfully merging this pull request may close these issues.

2 participants