简体   繁体   中英

Override typescript module exports definition

I have installed plugin that ship with types definition.

declare module 'autobind-decorator' {
  const autobind: ClassDecorator & MethodDecorator;
  export default autobind;
}

But, I thought that type definition was wrong. I need to change to this

declare module 'autobind-decorator' {
  const autobind: ClassDecorator & MethodDecorator;
  export = autobind;
}

How can I do that?

How can I do that

Fork the project and publish (till the original gets fixed).

More

This is essentially if an author publishes a bad JS lib how do I fix it . You would fix it by forking. TypeScript doesn't offer much magic here.

Reason

If TypeScript offered a way to override it, it would lead to only confusion which definition is used .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM