问题:如何解决Typescript编译器(tsc
(错误">命名空间"NodeJS"没有导出的成员"Global">"?
在运行tsc
时,我突然在";"遗留";(不是新的(项目:
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> {
~~~~~~
我尝试添加安装@types/node
,并将"types": ["node"]
添加到我的tsconfig
中(如本文SO文章中所建议的(,但这并没有帮助。
节点版本:12.18.4
Jest版本:26.5.3
这是一个已知的错误:https://github.com/facebook/jest/issues/11640
降级到@types/node
v15.14.0对我来说似乎可以解决这个错误。
我能够通过将"skipLibCheck": true
添加到我的tsconfig
中来解决这个问题。
TFM:https://www.typescriptlang.org/tsconfig#skipLibCheck