You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I love how easy is to include typescript, but I was wondering whether it would be possible to disable static type checking and let only Babel strip types. The reasons are following:
In dev you are using external UI to compile and check types. This is doing the same work twice. This leads to point 2
Performance, I assume that this would decrease build and rebuild times
Refactoring. Often, during refactor I’d like to test partial functionality even when errors are present. Currently it’s all or nothing.
All and all I think static type check is great during build times, but at dev stage it comes in the way.
What do you think? Can you maybe point me to place where I could disable it? Thanks
Reacted by Tanay Pratap, Fernando Alex Helwanger, Thomas Charlat, Dominik Tarnowski, Thomas Ladd, vlad-khitev-axon, Denys Nykula, Sibelius Seraphini, Maxime Garcia, Łukasz Sentkiewicz and 15 more
@ianschmitz I disagree with closing this issue. The FLAG only allows to run the project on faulty compilation (and adresses only 1 out of 4 points raised).
It is still not possible to completely disable the compilation.
We run the type checking asynchronous from the compile now. The impact should be low. If you can provide concrete examples of before/after time comparisons that show the type checking is negatively impacting build times I'd be happy to reconsider!
In my case it impacts on development time. VSCode is already type checking the project and I hardly ever check the terminal for type errors. They're better displayed in the editor.
So the type checking is running unnecessarily twice.
Understood. But are you experiencing slower compilation time as a result compared to if type checking was disabled? If not then I don't see the harm. If so then I would love to see comparison metrics to understand the cost in your specific project.
My case might be more suitable for another "issue" then? Because the compilation time is not significantly impactful in my case.
Thank you in advance for your time.
@ianschmitz as much as I appreciate the efforts you guys put into this project, I do not agree with this argument. The compilation is taking unnecessary resources, cpu, memory ... which on many machines are thin as it is. I explored my case and in my reasonably sized project the compiler takes 320mb of memory and jumps between 5-25% cpu time on my MB pro 2017.
Being a bit @ss about it, we can also let SETI run in the background since it will only marginally affect compilation time.
The CRA is already heavy as it is and some level of co figuration would be greatly appreciated.
Reacted by Denys Nykula, strothj, Olivier Louvignes and Frederik Batuna
I strongly agree with @tomitrescak here, if you use vscode, the ForkTsCheckerWebpackPlugin is redundant/useless and only slows down livereloading. In my opinion you should disable the plugin by default in dev mode unless configured otherwise (eg. with a "strict"-like option).
Currently bypassing this requires advanced fragile hacks (excluding ForkTsCheckerWebpackPlugin and nulling paths.appTsConfig).
Regarding the performance impact. In my small to medium sized monorepo (with roughly 100 ts files using a ts-enabled UI framework, ant-design, results are:
Default: ~3s per save before reload (with ~1.5s waiting for typescript)
Without redundant TS checks: ~1.5s
So roughly 100% performance penalty on every save!
react-app-rewired config-overrides.js repro:
module.exports={// The Webpack config to use when compiling your react app for development or production.webpack(config,env){// Drop noisy eslint pre-ruleconfig.module.rules.splice(1,1);// Drop noisy tslint pluginconstEXCLUDED_PLUGINS=['ForkTsCheckerWebpackPlugin'];config.plugins=config.plugins.filter(plugin=>!EXCLUDED_PLUGINS.includes(plugin.constructor.name));returnconfig;},// The paths config to use when compiling your react app for development or production.paths: function(paths,env){// Disable react-scripts TypeScript handlingpaths.appTsConfig='';returnpaths;}};
Activity
tanaypratap commentedon Nov 13, 2018
Going through the same problem. If you rewrite tsConfig.json it goes back to previous fixed format! Weird!
td0m commentedon Nov 17, 2018
+1 for that.
I go into a lot more detail about this in #5820. Possible duplicate?
feat(typescript): add skip typecheck env
lstkz commentedon Mar 20, 2019
My workaround:
config-overrides.jsaddFull example
dortamiguel commentedon Aug 4, 2019
Looks like no longer works with latest, do you have any other alternative to this?
freddi301 commentedon Mar 4, 2020
https://create-react-app.dev/docs/advanced-configuration/#! ctr+f TSC_COMPILE_ON_ERROR
ianschmitz commentedon Mar 5, 2020
Ah yes looks like we provided an escape hatch to satisfy this issue. Closing!
tomitrescak commentedon Mar 5, 2020
@ianschmitz I disagree with closing this issue. The FLAG only allows to run the project on faulty compilation (and adresses only 1 out of 4 points raised).
It is still not possible to completely disable the compilation.
ianschmitz commentedon Mar 5, 2020
We run the type checking asynchronous from the compile now. The impact should be low. If you can provide concrete examples of before/after time comparisons that show the type checking is negatively impacting build times I'd be happy to reconsider!
maurealtrends commentedon Mar 5, 2020
In my case it impacts on development time. VSCode is already type checking the project and I hardly ever check the terminal for type errors. They're better displayed in the editor.
So the type checking is running unnecessarily twice.
ianschmitz commentedon Mar 5, 2020
Understood. But are you experiencing slower compilation time as a result compared to if type checking was disabled? If not then I don't see the harm. If so then I would love to see comparison metrics to understand the cost in your specific project.
maurealtrends commentedon Mar 5, 2020
My case might be more suitable for another "issue" then? Because the compilation time is not significantly impactful in my case.
Thank you in advance for your time.
tomitrescak commentedon Mar 5, 2020
@ianschmitz as much as I appreciate the efforts you guys put into this project, I do not agree with this argument. The compilation is taking unnecessary resources, cpu, memory ... which on many machines are thin as it is. I explored my case and in my reasonably sized project the compiler takes 320mb of memory and jumps between 5-25% cpu time on my MB pro 2017.
Being a bit @ss about it, we can also let SETI run in the background since it will only marginally affect compilation time.
The CRA is already heavy as it is and some level of co figuration would be greatly appreciated.
mgcrea commentedon Mar 7, 2020
I strongly agree with @tomitrescak here, if you use vscode, the
ForkTsCheckerWebpackPluginis redundant/useless and only slows down livereloading. In my opinion you should disable the plugin by default in dev mode unless configured otherwise (eg. with a "strict"-like option).Currently bypassing this requires advanced fragile hacks (excluding
ForkTsCheckerWebpackPluginand nullingpaths.appTsConfig).Regarding the performance impact. In my small to medium sized monorepo (with roughly 100 ts files using a ts-enabled UI framework, ant-design, results are:
So roughly 100% performance penalty on every save!
react-app-rewired
config-overrides.jsrepro: