覆盖打字稿模块导出定义
Override typescript module exports definition
我已经安装了带有类型定义的插件。
declare module 'autobind-decorator' {
const autobind: ClassDecorator & MethodDecorator;
export default autobind;
}
但是,我认为类型定义是错误的。我需要改成这个
declare module 'autobind-decorator' {
const autobind: ClassDecorator & MethodDecorator;
export = autobind;
}
我该怎么做?
How can I do that
分叉项目并发布(直到修复原始项目)。
更多
这本质上是如果作者发布了错误的 JS 库,我该如何修复它。你会通过分叉来修复它。 TypeScript 在这里并没有提供太多魔力。
原因
如果 TypeScript 提供了一种覆盖它的方法,那只会导致混淆使用了哪个定义。
我已经安装了带有类型定义的插件。
declare module 'autobind-decorator' {
const autobind: ClassDecorator & MethodDecorator;
export default autobind;
}
但是,我认为类型定义是错误的。我需要改成这个
declare module 'autobind-decorator' {
const autobind: ClassDecorator & MethodDecorator;
export = autobind;
}
我该怎么做?
How can I do that
分叉项目并发布(直到修复原始项目)。
更多
这本质上是如果作者发布了错误的 JS 库,我该如何修复它。你会通过分叉来修复它。 TypeScript 在这里并没有提供太多魔力。
原因
如果 TypeScript 提供了一种覆盖它的方法,那只会导致混淆使用了哪个定义。