-
-
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
Support for project references #10695
Comments
Did a little investigation and noticed that create-react-app actually uses https://github.com/TypeStrong/fork-ts-checker-webpack-plugin for TypeScript checking. That actually does support Unfortunately when I tried to upgrade to the latest version I got an error (without any stack trace): Upgrading to v5 would probably be pretty involved, so I stopped investigating there. For the time being, I've just decided to use diff --git a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
index 949f34a..0b3b54e 100644
--- a/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
+++ b/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js
@@ -58,6 +58,7 @@ function verifyNoTypeScript() {
}
function verifyTypeScriptSetup() {
+ return
let firstTimeSetup = false;
if (!fs.existsSync(paths.appTsConfig)) { It "works" in that CRA doesn't update my tsconfig anymore, but I don't get any output in the terminal or in the error overlay when there's a TS error. This actually works out better for my use case, so this workaround works for me. |
Also interested in this, we have a large project that I would like to "drop in" a react native app alongside other projects and leverage all the code we have. This issue references another with other investigations #6799 |
Yes, it seems pretty awkward that at this point in time CRA still hasn't solved this issue.
In the CRA Project, everything works well in the editor (VS Code) but the project won't start. |
+1 mono repos with Typescript would really benefit here |
+1, been hoping for that feature for years now 🙏 |
+1 can't believe this issue is already +3 years old |
Is your proposal related to a problem?
I'm using create-react-app for my React workshops. Each project has an exercise file (the unfinished code) and a final file (the finished code). I'm rewriting them all to TypeScript. I don't want to enable strict mode for the exercise files because it can be difficult for people new to TypeScript. However I do want the final version of the exercise to be type checked with strict mode (for my own sake).
Having different configs for different files in a project can be accomplished using project references configuration. Here's what I've done to make this "work": kentcdodds/react-fundamentals@84eb9ed
tsconfig.json
config/tsconfig.exercise.json
config/tsconfig.final.json
config/tsconfig.shared.json
Running
tsc -b
will typecheck all the files with the expected configuration.However, as soon as I run
react-scripts start
, mytsconfig.json
gets changed:With those changes, when I try to run
tsc
(ortsc -b
), I get several errors, for example:By setting
"noEmit": false
and"composite": true
to theconfig/tsconfig.shared.json
, I get a little further, but can't get rid of this error:I've tried all combinations of options I can think of and nothing I can think of will make TypeScript happy + accomplish my goal of having a different config for different files in my create-react-app project.
Describe the solution you'd like
I would like support for
references
directly. I did notice ts-loader's page on references.Short of that, I would be happy with an environment variable (similar to
SKIP_PREFLIGHT_CHECK
) which opts-out of updating thetsconfig.json
and just trusts that the config works as-is.Describe alternatives you've considered
I've thought about switching off of create-react-app or using one of the off-shoot projects that are flexible, but I'd really prefer to not do that.
Additional context
I think I've said everything that needs to be said 😅
The text was updated successfully, but these errors were encountered: