Skip to content
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

Dev Server does not always show typescript compilation errors #10852

Open
jdgreenberger opened this issue Apr 19, 2021 · 6 comments
Open

Dev Server does not always show typescript compilation errors #10852

jdgreenberger opened this issue Apr 19, 2021 · 6 comments

Comments

@jdgreenberger
Copy link

jdgreenberger commented Apr 19, 2021

Describe the bug

React dev server does not consistently display typescript errors. Frequently, when running react-scripts start, the compiler does not display typescript errors and I only see them when running react-scripts build. I have noticed that this happens more frequently when there is a typescript error in files that have not been modified or when the dev server is consuming more CPU. Any ideas on why this happens and how to address it?

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

"typescript errors" "typescript changes"

Environment

current version of create-react-app: 3.4.1

System:
OS: macOS 11.2.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 12.7.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.10.0 - /usr/local/bin/npm
Browsers:
Chrome: 89.0.4389.128
Firefox: 85.0.2
Safari: 14.0.3
npmPackages:
react: 16.10 => 16.10.2
react-dom: 16.8.6 => 16.8.6
react-scripts: ^4.0.3 => 4.0.3
npmGlobalPackages:
create-react-app: Not Found

Steps to reproduce

  1. Create a CRA typescript project of sufficient size (couple hundred files)
  2. Run dev server
  3. Trigger an error in a file you didn't change

Expected behavior

Errors show up in the console

Actual behavior

Compiles without error

Reproducible demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@jdgreenberger
Copy link
Author

jdgreenberger commented Apr 20, 2021

Update: on the latest version I can't get any typescript errors to show up. My .env is

FAST_REFRESH=false
ESLINT_NO_DEV_ERRORS=true
TSC_WATCHFILE=UseFsEventsWithFallbackDynamicPolling

@jdgreenberger
Copy link
Author

Any update on this?

@nj314
Copy link

nj314 commented Sep 16, 2021

@jdgreenberger I had a similar symptom and fixed it by upgrading my typescript devDependency from ^3.9.0 to ^4.0.2. I was getting the expected eslint warnings / errors all along, but not the errors from tsc. This was on an existing project which had been migrated from CRA 3 to 4. After upgrading to TypeScript 4.x I started getting expected tsc compilation errors from react-scripts start.

@stale
Copy link

stale bot commented Jan 9, 2022

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.

@stale stale bot added the stale label Jan 9, 2022
@davetapley
Copy link

I got this too going from react-scripts 3.4.1 to 4.0.3 and #10852 (comment) fixed it.

I was about to open another issue to bump peerDependency, but I see that happened in #9964, albeit to:

"peerDependencies": {
"typescript": "^3.2.1 || ^4"
},

I'm going to ask over there why ^3.2.1 || 🤔

@rostero1
Copy link

rostero1 commented Jul 7, 2023

With typescript 5.1.3 as an override, I'm having a similar issue.

I am no longer presented with a typescript error (with npm start) when I have function Component(props: Props) { console.log(notprops) }. It does show the error in my IDE, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants