加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

reactjs – node_modules/@ types/react-dom /中的错误.后续变量

发布时间:2020-12-15 05:08:07 所属栏目:百科 来源:网络整理
导读:我已经安装了@ types / react-dom以及typescript和@ types / react以及@ types / meteor但是当我尝试从命令行运行typechecker时我收到以下错误 您可以重现错误并在此处查看我的所有配置:https://github.com/Falieson/react15-meteor1.5 谢谢你的帮助! $met
我已经安装了@ types / react-dom以及typescript和@ types / react以及@ types / meteor但是当我尝试从命令行运行typechecker时我收到以下错误

您可以重现错误并在此处查看我的所有配置:https://github.com/Falieson/react15-meteor1.5

谢谢你的帮助!

$meteor npm run type:client

> react-meteor-example@0.1.0 type:client /Users/sjcfmett/Private/ReactMeteorExample
> tslint -p ./tsconfig.json --type-check './client/**/*.{ts,tsx}'

Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3422:13: 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>'.
Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3423:13: 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>'.
Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3424:13: Subsequent variable declarations must have the same type.  Variable 'address' must be of type 'DetailedHTMLProps<HTMLAttributes<HTMLElement>,HTMLElement>'.
Error at node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3425:13: Subsequent variable declarations must have the same type.  Variable 'area' must be of type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>,HTMLAreaElement>',but here has type 'DetailedHTMLProps<AreaHTMLAttributes<HTMLAreaElement>,HTMLAreaElement>'.
... (shortened)

package.json(供参考)

{
  "name": "react-meteor-example","version": "0.1.0","private": true,"scripts": {
    "start": "meteor run","lint:client": "tslint --fix -c ./tslint.json -p ./tsconfig.json './client/**/*.{ts,tsx}'","lint:imports": "tslint --fix -c ./tslint.json -p ./tsconfig.json './imports/**/*.{ts,"lint:server": "tslint --fix -c ./tslint.json -p ./tsconfig.json './server/**/*.ts'","lint": "npm run lint:client && npm run lint:server && npm run lint:imports","type:imports": "tslint -p ./tsconfig.json --type-check './imports/**/*.{ts,"type:client": "tslint -p ./tsconfig.json --type-check './client/**/*.{ts,"type:server": "tslint -p ./tsconfig.json --type-check './server/**/*.ts'","type": "npm run type:client && npm run type:server && npm run type:imports","precommit": "npm run lint && npm run type"
  },"dependencies": {
    "babel-runtime": "^6.20.0","meteor-node-stubs": "~0.2.4","react": "^15.6.1","react-dom": "^15.6.1"
  },"devDependencies": {
    "@types/meteor": "^1.4.2","@types/react": "^15.6.0","@types/react-dom": "^15.5.1","babel-preset-react": "^6.24.1","babel-preset-stage-1": "^6.24.1","husky": "^0.14.3","tslint": "^5.5.0","tslint-react": "^3.1.0","typescript": "^2.4.2"
  }
}
React 16 beta的类型已作为“最新的”React类型发布.

新版本删除了React 16中已删除的React部分的定义(如React.DOM),这是预期的.

不幸的是,React 16 beta的这些类型的发布是在npm中的@latest(默认)标签而不是@next(如React所做的那样)完成的.

我有一个开放的问题(#18708),其中DefinitelyTyped:https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18708

您可以尝试专门针对特定版本(npm install –save @ types / react @ 15.6.0)但@ types / react-dom中对@ types / react的依赖关系设置为“*”,这似乎会导致@ types / react @ latest仍然可以下载,导致您在node_modules目录的不同位置拥有多个版本.

我们不得不做一些手工工作来解决这个问题.希望维护@ types / react的人们很快就会解决这个问题.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读