Reputation: 31365
I'm new to Typescript and I'm working with the following setup:
react
, redux
and react-redux
webpack
ForkTsCheckerWebpackPlugin
react-hot-loader
And I'm getting some weird behavior.
Sometimes I make changes to the types I'm using and ForkTsCheckerWebpackPlugin
will only show (or not show) type errors after I stop and restart webpack-dev-server
to compile everything again from scratch.
Is this a normal behavior? Do I need to recompile every time I make changes to the types I'm using?
For example:
The plugin is complaining about a IS_MOBILE
property that is missing from my LAYOUT
type.
This is because I was experimenting a new shape for this object.
But you can see that I already removed that property from my LAYOUT
interface, so that error should not be showing anymore.
Now I'm going to restart webpack
:
You can see from the image above that the error is now gone.
QUESTION
Is this the normal behavior for the ForkTsCheckerWebpackPlugin
? Do I need to recompile everything when I make those kind of changes? Or is it maybe cause because I'm using react-hot-loader
or some other config I should be using.
NOTE: The normal VSCode ts check throughout my opened files is working fine. They always immediately reflect the changes I make to the types I'm using.
PS: Those types are declared in d.ts
files using declare namespace {...}
Upvotes: 1
Views: 9742
Reputation: 41
Look like this bug https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/457
You can try to config ForkTsCheckerWebpackPlugin
new ForkTsCheckerWebpackPlugin({
typescript: {
build: true,
},
}),
but it's work around and not solution of the problem.
Upvotes: 3