An NPM package extends an interface in the global scope. How to override this type definition?

101 views Asked by At

I use the graphql-mesh package in my project. This library has the following type definition:

declare global {
  interface ObjectConstructor {
    keys<T>(obj: T): Array<keyof T>;
  }
}

This type definition breaks my build. I have errors like that:

Argument of type 'string | number | symbol' is not assignable to parameter of type 'string'.
  Type 'number' is not assignable to type 'string'.

278       expect(bar.get(Object.keys(given.foo)[0]))

How can I fix it? Is there an option to override this type in my project? Or can TypeScript compiler ignore this type definition?

0

There are 0 answers