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

TS2403 error #186

Closed
ikzjfr0 opened this issue Nov 7, 2017 · 2 comments
Closed

TS2403 error #186

ikzjfr0 opened this issue Nov 7, 2017 · 2 comments

Comments

@ikzjfr0
Copy link

ikzjfr0 commented Nov 7, 2017

Still using @types/react: ^15.6.6 while react version is 16.0.0

@ikzjfr0 ikzjfr0 changed the title TS2403 TS2403 error Nov 7, 2017
@mnemanja
Copy link

mnemanja commented Nov 7, 2017

Having the same issue just now.
Here's the output from the clean start after the instantiation:

Warning: The 'no-use-before-declare' rule requires type information.
ts-loader: Using typescript@2.5.3 and C:\www\my-ts-app\tsconfig.json
Failed to compile.

C:\www\my-ts-app\node_modules\@types\react-dom\node_modules\@types\react\index.d.ts
(3533,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'a' must be of type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>', but here has type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>'.

@DorianGrey
Copy link
Collaborator

TS2403 is about duplicated definitions of the same type.
As you see in the error message above, there is a duplicate for @types/react below @types/react-dom (node_modules\@types\react-dom\node_modules\@types\react\index.d.ts), while it should as well be in the root of node_modules (node_modules\@types\react\index.d.ts).

This error is not caused by CRA or this fork, but by the package manager that did not properly dedupe this dependency after an update. That is a known issue - especially for yarn. The error mentioned does not occur on a clean project.

If you are using npm, you should try a npm dedupe: https://docs.npmjs.com/cli/dedupe
If you are using yarn, try a flat installation: https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-flat

In both cases, removing the particular lock file and performing a clean install of your projects dependencies will help.

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

No branches or pull requests

3 participants