【发布时间】:2017-05-18 19:51:18
【问题描述】:
我正在使用组件 react-router-bootstrap 和来自 DefinitelyTyped 的定义。我的问题是下载的定义与组件不匹配。我创建了一个拉取请求来解决这个问题,但由于我不知道它什么时候会被修补,所以我必须覆盖它。我不能只在本地编辑位于node_modules\@types 中的类型定义文件,因为我们是一个致力于此项目的团队,而node_modules 文件夹未签入。
如何覆盖类型定义?我只是不想覆盖 LinkContainer.d 文件,因为其他文件可以工作。
拉取请求:
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/16600
我尝试在我的类型文件夹中创建一个名为 LinkContainer.d.ts 的文件,该文件是正确的,但没有被拾取。在同一个文件夹中,我有一个 global.d.ts,其接口可以很好地拾取。
/// <reference types="react-router-bootstrap" />
import { ComponentClass } from "react";
import { NavLinkProps } from "react-router-dom";
type LinkContainer = ComponentClass<NavLinkProps>;
declare const LinkContainer: LinkContainer;
export default LinkContainer;
【问题讨论】:
标签: reactjs typescript react-bootstrap