我正在尝试使用支持搜索解析的方法来扩展反应路由器的历史记录。
我尝试将模块定义和扩展名移至单独的文件,以不同的名称导入历史记录,因为该名称与全局ts历史记录定义冲突。
import { History } from "history";
declare module "history" {
interface History {
test: () => void;
}
}
export function test(this: History) {
console.log(this);
}
// History here is refering to lib.d.ts history for some reason
History.prototype.test = test; // ERROR: test does not exitst on preprty of type History<any>