-
-
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
Friction in TypeScript setup experience #6119
Comments
The issue is #5939 was that npx was using an old, cached version of Create React App. Perhaps the case for you too? |
I'm guessing we should file a bug with npx or find an alternative way of creating apps, does "npm init react-app" behave differently? |
I agree though, this has happened a few times so it's probably worth mentioning it to npm. |
@DanielRosenwasser I can confirm that I'm not hitting this issue on my machine either, I don't have a global install of Could you confirm if you do? Also, have you tried running |
I am running into the same issue right now trying to create my first typescript react app using npx create-react-app myapp --typescript. I have create-react-app installed globally. |
If you're using
|
@ianschmitz You were right, I globally uninstalled create-react-app (and typescript just to be safe) and it worked this time around! Thanks for the help! |
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. |
It is necessary to uninstall any version that was previously installed for the typescript flag to work when using npx.
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. |
In trying to update the TypeScript React Starter, I'm trying to leverage the newly supported support in CRA; however, running
create-react-app
with the--typescript
flag seems to not do anything, and the process of adding TypeScript in general has a bit of friction.As an example, I ran
I expected at least the following:
.ts
/.tsx
files.tsconfig.json
file should have been given to me out of the box.typescript
,@types/react
, and@types/react-dom
.Instead,
--typescript
flag didn't do anything special, and I had to rename a file likeApp.js
toApp.tsx
beforeyarn start
gave me atsconfig.json
.yarn start
told to runyarn add typescript
after the rename (which is misleading since it should be adevDependency
- soyarn add -D typescript
).yarn start
one more time, I was given a type-error because I was missing@types/react
and@types/react-dom
asdevDependencies
.Then everything worked, but this feels extremely frictiony. And it's also fairly confusing, because this flag doesn't seem to give anything beyond what the standard CRA scaffolding gives. And other issues have pointed this out too:
The text was updated successfully, but these errors were encountered: