Friction in TypeScript setup experience
Created by: DanielRosenwasser
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
npx create-react-app myapp --typescript
I expected at least the following:
- My files should have been
.ts/.tsxfiles. - A prescriptive
tsconfig.jsonfile should have been given to me out of the box. - My devDependencies should have included
typescript,@types/react, and@types/react-dom.
Instead,
- The
--typescriptflag didn't do anything special, and I had to rename a file likeApp.jstoApp.tsxbeforeyarn startgave me atsconfig.json. -
yarn starttold to runyarn add typescriptafter the rename (which is misleading since it should be adevDependency- soyarn add -D typescript). - Running
yarn startone more time, I was given a type-error because I was missing@types/reactand@types/react-domasdevDependencies.
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: