Skip to content
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

Error screen after npm start (typescript) #8718

Closed
programateus opened this issue Mar 25, 2020 · 2 comments
Closed

Error screen after npm start (typescript) #8718

programateus opened this issue Mar 25, 2020 · 2 comments

Comments

@programateus
Copy link

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

@getspooky
Copy link

The problem is caused by pretty-format/build/index.d.ts so the temporary solution is to change

import type * as PrettyFormat from './types';

to

import * as PrettyFormat from './types';

Path : @types/testing-library__react/node_modules/pretty-format/build/index.d.ts

@programateus
Copy link
Author

I'm closing this issue as I found the solution here #8717 (comment)

@lock lock bot locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants