-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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 compilation opt-in ? #6041
Comments
Hi @shavyg2, this is currently by design - and I'm sorry you've found the experience frustrating. I want to add that I'm using this in production applications and haven't faced any issues with the implementation being slow or buggy, but it could certainly be improved and we're always looking at ways to do that. One option could be to keep your TS files outside of How do you propose the configuration might look to opt-out? |
I don't know why it's slow but others are experiencing it too. I fixed it-ish by doing this inside react-scripts in the webpack.dev.config // TypeScript type checking
useTypeScript && false &&
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules,
}),
async: false,
checkSyntacticErrors: true,
tsconfig: paths.appTsConfig,
compilerOptions: {
module: 'esnext',
moduleResolution: 'node',
resolveJsonModule: true,
isolatedModules: true,
noEmit: true,
jsx: 'preserve',
},
reportFiles: [
'**',
'!**/*.json',
'!**/__tests__/**',
'!**/?(*.)(spec|test).*',
'!src/setupProxy.js',
'!src/setupTests.*',
],
watch: paths.appSrc,
silent: true,
formatter: typescriptFormatter,
}), Now it's not so slow and i am able to use it. Interms of typescript it should either allow me to use my own tsconfig and never overwrite it. My app works perfectly fine, but some props are missing in documented places that are not needed. To enforce typechecking at compile time is to agree that all libraries that can possible be used will have correctly define types across the npm/javascript ecosystem and therefore should be enforced! Seems too big of a statement. This could be opt in and so could they actually typescript type checking using the .env There is already one for SKIP_PREFLIGHT_CHECK=true that way i don't have to change that to false everytime to get my project to compile. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This is not stale, it is unresolved. Stalebot should be able to distinguish this :( |
Update: After playing around with the configuration for a while and bypassing the verify script, the problem still remains. Repro: https://github.com/Roustalski/broken-inversify |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
Is this a bug report?
No
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
create-react-app replaces tsconfig
use typescript without create-react-app compile
Environment
Windows / Linux Subsystem
Steps to Reproduce
Expected Behavior
I wanted react to compilation of my application to be opt-in
Actual Behavior
react decides it should compile my typescript file,
because i have a tsconfig.json
If I remove the tsconfig.json it still complains and tries to compile it and fails as there is no typescript.
The compilation of typescript on the react dev server is very slow and buggy and doesn't reload, most times i get just a white screen until i reload the page. (seperate issue)
I have solved this issue by just using tsc -w and compiling to js and jsx which react pretty quickly will hot-reload.
This has been working very well and i just keep the repo clean of js and jsx files via a gitignore.
Now there seems to be no way for me to opt out of react transpiling my typescript code.
https://facebook.github.io/create-react-app/docs/adding-typescript
The text was updated successfully, but these errors were encountered: