React没有导出的成员LinkHTMLAttributes

时间:2017-12-04 12:35:09

标签: node.js reactjs npm webpack visual-studio-2017

我正在使用vs2017,npm和webpack构建一个react应用程序。

由于标题中描述的错误,我无法让vs构建我的解决方案:

  

错误TS2694构建:命名空间“React”没有导出成员   'LinkHTMLAttributes'。 SpyStore.React C:\ Work \ Development \ React \ Spystore \ SpyStore.React \ SpyStore.React \ node_modules \ @types \ react-router \ lib \ Link.d.ts 10

Js文件:\ node_modules \ @types \ react-router \ lib \ Link.d.ts

import * as React from 'react';
import Router from './Router';

declare const Link: Link;
type Link = Link.Link;

export default Link;

declare namespace Link {
    interface LinkProps extends React.LinkHTMLAttributes<Link> {
        activeStyle?: React.CSSProperties;
        activeClassName?: string;
        onlyActiveOnIndex?: boolean;
        to: Router.RoutePattern | Router.LocationDescriptor | ((...args: any[]) => Router.LocationDescriptor);
    }

    interface Link extends React.ComponentClass<LinkProps> {}
    interface LinkElement extends React.ReactElement<LinkProps> {}
}

这些是我的package.json中的依赖项和devdependencies:

"dependencies": {
    "jquery": "3.1.1",
    "react": "15.4.2",
    "react-dom": "15.4.2",
    "react-router": "3.0.2"
  },
  "devDependencies": {
    "@types/jquery": "1.10.31",
    "@types/react": "0.0.0",
    "@types/react-router": "^2.0.41",
    "typescript": "2.1.6",
    "tslint": "4.4.2",
    "webpack": "2.2.1",
    "webpack-dev-middleware": "1.10.0",
    "webpack-dev-server": "2.3.0",
    "webpack-md5-hash": "0.0.5",
    "webpack-merge": "2.6.1",
    "awesome-typescript-loader": "3.0.4-rc.2",
    "url-loader": "0.5.7",
    "ts-helpers": "1.1.2",
    "ts-loader": "2.0.0",
    "ts-node": "2.1.0",
    "tslint-loader": "3.3.0",
    "open-browser-webpack-plugin": "0.0.3",
    "extract-text-webpack-plugin": "1.0.1",
    "file-loader": "0.10.0",
    "html-loader": "0.4.4",
    "html-webpack-plugin": "2.28.0",
    "compression-webpack-plugin": "0.3.2",
    "copy-webpack-plugin": "4.0.1",
    "source-map-loader": "0.1.6"
  }

我试图删除我的node_modules并重新安装它们。

没有成功。 任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

嗯,显然我没有足够长时间搜索..不耐烦我..

我的视觉工作室没有显示任何关于错误的智能感知,但经过一些尝试我只需要将我的react-router更新为更新的版本;)