-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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 prevents compilation #5937
Comments
This is an actual TypeScript error. You need to follow the instructions given by the TypeScript compiler or turn off strict mode. |
I just want to confirm: Typescript errors will prevent compilation, is that correct? If this is a feature not a bug, would you mind if I added something to the docs mentioning that — I think most people expect Typescript not to actually prevent compilation unless there's a parsing error. |
Yes.
Can you explain the reasoning behind this? If there's an error in your code, why would you want it to run? |
Well, there's an error in the Typescript, but not in what would be the compiled JS. The change just caught me by surprise. When I added Typescript a few months ago to my CRA project, the behavior was Typescript checking in my IDE/console but it would still compile with errors (strip out types) and I understand the decision you've made — not arguing against that. Just saying I for one was surprised by this behavior and would not have spent time filing this bug if I had realized it wasn't a bug at all (i.e. the docs had said this is what happens), which might be an indication that others will be confused. |
We've never supported TypeScript in the past -- can you elaborate on your previous setup? I appreciate you bringing this up though, I know we have a lot of work to do on improving our docs. :-) |
Actually, I read the ^2.1.0 docs while not being on 2.1.0 (without realizing it didn't apply to me) so I ran:
Which probably triggered IntelliJ to see I had .ts/.tsx files as I opened them, compile them (while editing) into .js files which were picked up in the compilation. So effectively a flow that didn't compile Typescript synchronously. I'm using |
We have a PR to speed this up: #5903 |
Is this a bug report?
Yes
Did you try recovering your dependencies?
Environment
Expected Behavior
I expect
yarn start
to compile even with Typescript errors. Typescript is, by my understanding of CRA's philosophy, just an extra layer but won't prevent compilation.yarn start
worked fine with Typescript errors a few days ago, not sure what I changed but I came into Typescript pre-2.1.0 and I may have updated accidentally.Actual Behavior
I get a Typescript compile error. Using a reproducible demo:
I create a simple reproducible demo:
with the following
index.tsx
:and I get the following error after
yarn start
:I've been digging through the webpack configuration (slowly) and it seems like this might be related?
The text was updated successfully, but these errors were encountered: