Rohman HM
Rohman HM

Reputation: 2827

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?

Upvotes: 2

Views: 1183

Answers (1)

basarat
basarat

Reputation: 276209

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.

Upvotes: 1

Related Questions