Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

when i exec yarn start , it will throw a error !!! #274

Closed
littleLane opened this issue Mar 7, 2018 · 10 comments
Closed

when i exec yarn start , it will throw a error !!! #274

littleLane opened this issue Mar 7, 2018 · 10 comments

Comments

@littleLane
Copy link

Is this a bug report?

It can't be nice after i operate according to the steps, it will throw a error that

.../nervjs-typescript/node_modules/@types/react-dom/node_modules/@types/react/index.d.ts
(3631,13): Subsequent property declarations must have the same type.  Property 'a' must be of type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>', but here has type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>'.

Environment

  1. node -v: 6.11.3
  2. npm -v: 5.7.1
  3. yarn --version : 1.2.0

Steps to Reproduce

  1. create-react-app nervjs-typescript --scripts-version=react-scripts-ts
  2. cd nervjs-typescript
  3. yarn start
@tiagovtristao
Copy link

I was actually about to post this same issue!

I tried different environments, namely:

  1. node / npm => 8.10.0 / 5.6.0
  2. node / npm => 7.10.1 / 4.2.0
  3. node / npm => 6.9.1 / 3.10.8

I've been noticing this problem in other projects too recently. And I come to think that the react types are the source of the problem. Basically, it seems that if your project depends on it and one of your dependencies does as well, it will throw this error.

@kigorw
Copy link

kigorw commented Mar 7, 2018

@littleLane, @tiagovtristao
yarn add @types/[email protected] fixes the problem

@ptommasi
Copy link

ptommasi commented Mar 7, 2018

I had the same issue, for some odd reason, in the latest create-react-app script, in the generatedpackage.json the property @types/react-dom has been downgraded from ^16.0.3 to ^15.5.7 , which seems to cause the error.

@nottoseethesun
Copy link

For me, the only thing that worked (this is using npm not yarn), was this:

	rm -rf node_modules/@types/react-dom
	npm upgrade --save @types/react-dom

@robertmassaioli
Copy link

I just modified the react-dom dev dependency to be 16.0.4 from 15.5.7 as @kigorw said, performed a yarn install followed by a yarn start and everything started working. Nice suggestion! The project should be fixed to bump that dependency.

@littleLane
Copy link
Author

Thanks,it started working as @kigorw said!
@tiagovtristao @ptommasi you can do that make it starts working!

@littleLane
Copy link
Author

I pulled a request to resolve the error!!

@DorianGrey
Copy link
Collaborator

I'm afraid that fix won't fix anything - esp. since it only updates this project's development dependencies...
This problem seems to reside somewhere else. The init script of react-scripts-ts installs @types/react-dom without any version suffix. When doing this manually, I'm getting this... (checked on a project without any further react dependency, npm 5.6.0).

npm i -D @types/react-dom
+ @types/[email protected]
removed 1 package and updated 2 packages in 10.079s

This is not the latest version, and is definitely an extremely curious behavior. However, it does not seem to be related to create-react-app-typescript.

@sebald
Copy link
Contributor

sebald commented Mar 14, 2018

Enabling skipLibCheck in your tsconfig.json should fix this.

@smitthakkar1
Copy link

smitthakkar1 commented Jun 14, 2018

@sebald it worked but can you please explain why it worked?

edit: I saw it skip type checking of all declaration files. Is it harmful or doesn't make any difference?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants