现在我使用typescript 的 v2.1.5版本
使用webpack打包文件
之前已经装过依赖包和@types了
但是我在编译的时候一直报history模块的一个错误:
[ts]Type 'History' is not assignable to type 'History'. Two different types with this name exist, but they are unrelated.
我看了一下history/index.d.ts, 发现里面有多个export ... history, 如:
export as namespace History;export interface History {
...
}export namespace History {
...
}createBrowserHistory.d.ts
import { History } from './index';import { getConfirmation } from './DOMUtils';export interface BrowserHistoryBuildOptions {
basename?: string;
forceRefresh?: boolean;
getUserConfirmation?: typeof getConfirmation;
keyLength?: number;
}export default function createBrowserHistory(options?: BrowserHistoryBuildOptions): History;我想知道这些这个问题怎么解决?怎样才能编译通过?
胡子哥哥
相关分类