【发布时间】:2017-02-13 00:48:14
【问题描述】:
我想在 RouteProps 接口中添加一个名称属性。没有它我得到:
错误 TS2339:“IntrinsicAttributes & > IntrinsicClassAttributes> & RouteProp...”类型上不存在属性“名称”
如果我将 name?: string; 添加到外部 Route.d.ts 文件中,错误就会消失。
我尝试了多种建议的方式合并模块,但均未成功。
外部 Route.d.ts 声明的开头是这样的:
declare const self: self.Route;
type self = self.Route;
export default self;
declare namespace self {
interface RouteProps extends React.Props<Route> {...
我正在使用 TypeScript 2。
【问题讨论】:
标签: typescript react-router typescript2.0