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

Subsequent property declarations must have the same type - Compilation error #313

Closed
slashburn opened this issue Apr 24, 2018 · 6 comments
Closed

Comments

@slashburn
Copy link

Is this a bug report?

yes

Environment

  1. npm ls react-scripts-ts (if you haven’t ejected):
    react-scripts-ts@2.15.1
  2. node -v: 9.10.1
  3. npm -v: 5.6.0
  4. yarn --version (if you use Yarn): 1.3.2

Then, specify:

  1. Operating system: macOS Sierra 10.12.6
  2. Browser and version (if relevant): Chrome Version 65.0.3325.181 (Official Build) (64-bit)

Steps to Reproduce

  1. npm install -g create-react-app
  2. create-react-app my-app --scripts-version=react-scripts-ts
  3. cd my-app/
  4. npm start

Expected Behavior

Start a minimal application

Actual Behavior

Boilerplate page will not show up.
Instead I get the following error message:

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

Package.json looks like this

{
  "name": "youtube-react",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "react-scripts-ts": "2.15.1"
  },
  "scripts": {
    "start": "react-scripts-ts start",
    "build": "react-scripts-ts build",
    "test": "react-scripts-ts test --env=jsdom",
    "eject": "react-scripts-ts eject"
  },
  "devDependencies": {
    "@types/jest": "^22.2.3",
    "@types/node": "^9.6.6",
    "@types/react": "^16.3.12",
    "@types/react-dom": "^16.0.5",
    "typescript": "^2.8.3"
  }
}

Reproducible Demo

Please follow the instructions in "Steps to Reproduce"

@gagarin55
Copy link

Any response ?

@wintermute42
Copy link

Same problem here. A response would be greatly appreciated :-)

@wintermute42
Copy link

Could be related to DefinitelyTyped/DefinitelyTyped#23644
Deleting and re-generating node_modules (and in my case yarn.lock as well as yarn cache) seems to have solved it.

@DorianGrey
Copy link
Collaborator

Cannot reproduce this in 2.16.0 (and a more recent yarn version of 1.6).

We've already had issues like this before:
#274
#186

In general, it occurs because of a resolution duplication of @types/react. This package is a direct dependency with a version range, but also referenced by @types/react-dom with a wildcard. That way, @types/react might be resolved to two different versions, thus resulting in duplicated type declarations.
If I've got that in mind correctly, recent versions of yarn can dedupe this properly.

@amites
Copy link

amites commented Jun 8, 2018

just ran a fresh install, got same error with Yarn 1.7.0

when I switched to another computer I was able to install correctly with Yarn 1.1.0

there are a few differences in package.json and a couple others -- happy to offer further details if anyone wants to look into this

of note is that when I copy the output "created" project it runs just fine under 1.7.0

@martinoss
Copy link

I had the same problem suddenly after updating some packages and run yarn run build. Deleted node_modules and yarn.lock and did a fresh install. This solved the error for me.

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

6 participants