Skip to content

Error screen after npm start (typescript) #8718

@programateus

Description

@programateus

Describe the bug

I don't really know if this can be a create-react-app issue, but...
I tried to create a typescript app, and when I do npm start it shows me this error:

C:/.../typescript/test/node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts
TypeScript error in C:/.../typescript/test/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

I tried creating a normal javascript and runing, and it worked ok

Did you try recovering your dependencies?

I installed with create-react-app test --template typescript --use-npm, tried deleting and redownloading dependencies, deleted package-lock.json, but nothing seems to fix it...
I also tried to put "esModuleInterop": false and "allowSyntheticDefaultImports": false, but didn't worked.

Which terms did you search for in User Guide?

I actually looked in the issues tab to see if it happened with someone else.

  • import type as PrettyFormat from
  • TypeScript error in '=' expected
  • TypeScript error in '=' expected PrettyFormat

Environment

Environment Info:

 current version of create-react-app: 3.4.1
 running from C:\Users\...\AppData\Roaming\npm\node_modules\create-react-app


System:
   OS: Windows 10 10.0.18363
   CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
 Binaries:
   Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
   Yarn: 1.22.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
   npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
 Browsers:
   Edge: 44.18362.449.0
   Internet Explorer: 11.0.18362.1
 npmPackages:
   react: ^16.13.1 => 16.13.1
   react-dom: ^16.13.1 => 16.13.1
   react-scripts: 3.4.1 => 3.4.1
 npmGlobalPackages:
   create-react-app: Not Found

Steps to reproduce

  1. create-react-app test --template typescript --use-npm
  2. cd test
  3. npm start

Expected behavior

It should just start the normal "boilerplate"

Actual behavior

Shows the normal react error screen.

Reproducible demo

https://github.com/mateusbds/test-repo

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