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

so sad...Subsequent variable declarations must have the same type. Variable 'a' must be of type #20863

Closed
txiaocao opened this issue Oct 23, 2017 · 6 comments

Comments

@txiaocao
Copy link

txiaocao commented Oct 23, 2017

  • I tried using the @types/react@latest package and had problems.
  • I tried using the latest stable version of tsc.
    npm run tsc -v
    3.10.10

the console

> @kemao-node-basis/project-tools@1.5.0 tsc /disk0/repository/kemao-node-basis/project-tools
> tsc "-p" "src"

node_modules/@types/react-dom/index.d.ts(16,43): error TS2305: Module '"/disk0/repository/kemao-node-basis/project-tools/node_modules/@types/react-dom/node_modules/@types/react/index"' has no exported member 'ReactPortal'.
node_modules/@types/react-dom/node_modules/@types/react/index.d.ts(3464,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>'.
node_modules/@types/react-dom/node_modules/@types/react/index.d.ts(3465,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'abbr' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.
node_modules/@types/react-dom/node_modules/@types/react/index.d.ts(3466,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'address' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>', but here has type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>'.

about the react tree

├── @types/node@7.0.46
├── @types/react@16.0.18
├─┬ @types/react-dom@16.0.2
│ ├── @types/node@8.0.46
│ └── @types/react@16.0.5
├─┬ @types/react-router@4.0.16
│ └── @types/history@4.6.1
├─┬ @types/tape@4.2.30
│ └── @types/node@8.0.46
├─┬ @types/uglify-js@2.6.29
│ └── @types/source-map@0.5.1
├─┬ @types/webpack@3.0.13
│ ├── @types/node@8.0.46
│ ├── @types/tapable@0.2.4
│ └── @types/uglify-js@2.6.28

I use yarn outdated yarn upgrade and deleted yarn.lock and use install @types/react@latest @types/react-dom@latest but not resolve the problem

@txiaocao
Copy link
Author

txiaocao commented Oct 23, 2017

use npm remove @types/react-dom --save-dev is okay....
maybe the @types/react-dom had the same @types/react???

@edidiway
Copy link

edidiway commented Nov 11, 2017

hi, I am also face the same problem
I am using @types/react-dom@16.0.3,

and this is the error
ERROR in [at-loader] ./node_modules/@types/react-dom/index.d.ts:16:43
TS2305: Module '"./node_modules/@types/react/index"' has no exported member 'ReactPortal'.

@ehrencrona
Copy link

The problem is that you are using a different version of @types/react from @types/react-dom. I can reproduce this issue e.g. using the following versions:

    "@types/react": "^15.6.7",
    "@types/react-dom": "^16.0.3",

Upgrading @types/react to 16.0.3 solves the issue.

@kajmagnus
Copy link

Also see this issue: #20942 — I had to add a resolutions: ... and tell Yarn to only use 16.0.x, because otherwise Yarn wanted to keep 15.x alongside with the new 16.0.x I'm upgrading to, and then Typescript found 99999 errors.

@dengue8830
Copy link

in my case if fix it with

"@types/react": "16.0.34",
"@types/react-dom": "16.0.3"

@orta
Copy link
Collaborator

orta commented Jun 7, 2021

Hi thread, we're moving DefinitelyTyped to use GitHub Discussions for conversations the @types modules in DefinitelyTyped.

To help with the transition, we're closing all issues which haven't had activity in the last 6 months, which includes this issue. If you think closing this issue is a mistake, please pop into the TypeScript Community Discord and mention the issue in the definitely-typed channel.

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

No branches or pull requests

6 participants