Jest.js 如何解决TypeScript编译器错误“命名空间'NodeJS'没有汇出的成员'Global'”?

hvvq6cgz  于 2022-12-08  发布在  Jest
关注(0)|答案(2)|浏览(364)

QUESTION: How can I resolve the Typescript Compiler ( tsc ) error "Namespace 'NodeJS' has no exported member 'Global'"?

While running tsc , I'm all of a sudden seeing the following error in a "legacy"(not new) project:

node_modules/expect/node_modules/@jest/types/build/Global.d.ts:85:62 - error TS2694: Namespace 'NodeJS' has no exported member 'Global'.

85 export interface Global extends GlobalAdditions, Omit<NodeJS.Global, keyof GlobalAdditions> {
                                                                ~~~~~~

I tried adding installing @types/node and adding "types": ["node"] to my tsconfig (as suggested in this SO post ), but that didn't help.

Node version: 12.18.4
Jest version: 26.5.3

vwoqyblh

vwoqyblh1#

这是一个已知错误:https://github.com/facebook/jest/issues/11640
降级到@types/node v15.14.0对我来说似乎可以解决这个错误。

z31licg0

z31licg02#

我能够通过将"skipLibCheck": true添加到我的tsconfig来解决这个问题。
TFM:https://www.typescriptlang.org/tsconfig#skipLibCheck

相关问题