0

我在我的项目中使用了graphql-mesh包。该库具有以下类型定义

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

这种类型定义破坏了我的构建。我有这样的错误:

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]))

我该如何解决?在我的项目中是否可以选择覆盖此类型?或者 TypeScript 编译器可以忽略这个类型定义吗?

4

0 回答 0