Skip to content

Friction in TypeScript setup experience #6119

Closed
@DanielRosenwasser

Description

@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:

  1. My files should have been .ts/.tsx files.
  2. A prescriptive tsconfig.json file should have been given to me out of the box.
  3. My devDependencies should have included typescript, @types/react, and @types/react-dom.

Instead,

  1. The --typescript flag didn't do anything special, and I had to rename a file like App.js to App.tsx before yarn start gave me a tsconfig.json.
  2. yarn start told to run yarn add typescript after the rename (which is misleading since it should be a devDependency - so yarn add -D typescript).
  3. Running yarn start one more time, I was given a type-error because I was missing @types/react and @types/react-dom as devDependencies.

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions