-
-
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
Poor documentation of what it means to use --typescript option #5939
Comments
There's an open PR that adds better documentation for the |
"create a project, but there was no evidence that typescript support was added" Have you updated your Create React App CLI tool? This is required for it to scaffold with TypeScript files. |
Timer, I think you are asking if I created a new create-react-app. I created a new one using "npx create-react-app --typescript". Just upgraded to latest npx on windows and have the same problem I reported last night. That first report was based on an install on a Mac (with a recently updated npm/npx). If you meant something else, please elaborate what I should do to "update my Create React App CLI tool". I started with a new project. |
|
Also, make sure you run |
npx create-react-app --version This is a fresh install of npx, so no cache was involved. Yes, I made sure --typescript was at the end. |
Ok, I see the latest version is 2.1.1, but somehow I got 1.5.1. I'll read up on how to banish cached older versions and report back. |
I force flushed my npm cache on the windows box, but npx continued to report version 1.5.1. So I tried this on my Ubuntu box and it got version 2.1.1 and use of "--typescript" indeed installed typescript and setup .tsx files instead of .js. Now I have to go back to the Mac where I first ran into this problem and figure out why it got stuck with an older version of create-react-app. |
Maybe try |
I found that I had an older version installed via Yarn, installed globally. Uninstalling it fixed my issues with NPX. |
I was excited to see the new --typescript option. Used it to create a project, but there was no evidence that typescript support was added. Then I discovered a documentation page suggesting I should rename .js to .tsx and restart the server. Did that, but got the following error. Not clear why this is happening if I already created a project with --typescript option. The whole point of using create-react-app (for a newbie react developer) is to get started without messing with any configuration, but adding typescript support doesn't look straightforward.
Appreciate any help with clear instructions on what --typescript actually does. If it isn't creating the scaffolding for typescript, should I follow instructions to add typescript support to an existing create-react-app?
`We detected TypeScript in your project (src/App.tsx) and created a tsconfig.json file for you.
It looks like you're trying to use TypeScript but do not have typescript installed.
Please install typescript by running npm install typescript.
If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files).`
The text was updated successfully, but these errors were encountered: