Skip to content

Create React App does not work with Typescript template #8717

@MatWrz

Description

@MatWrz

Describe the bug

On a fresh project setup via yarn and create-react-app, when I specific the typescript template, The project fails to build.

Did you try recovering your dependencies?

I have updated to the latest stable version of Yarn 1 (1.22.4) and latest version of create-react-app (create-react-app@3.4.1)

Which terms did you search for in User Guide?

Searched any references to typescript and the error as it presents itself.

Environment

Occurs both on Mac OS Catalina and WSL

Steps to reproduce

  1. yarn create react-app project --template typescript
  2. cd project
  3. yarn run build

error also present on yarn start

Expected behavior

Build success.

Actual behavior

yarn run build
yarn run v1.22.4
$ react-scripts build
Creating an optimized production build...
Failed to compile.

/home/matwrz/project/node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts
TypeScript error in /home/matwrz/project/node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts(7,13):
'=' expected.  TS1005

     5 |  * LICENSE file in the root directory of this source tree.
     6 |  */
  >  7 | import type * as PrettyFormat from './types';
       |             ^
     8 | /**
     9 |  * Returns a presentation string of your `val` object
    10 |  * @param val any potential JavaScript object


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproducible demo

Project that CRA generates from yarn create react-app project --template typescript
https://github.com/MatWrz/cra-project-issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions