最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I resolve the TypeScript Compiler error "Namespace 'NodeJS' has no exported member

programmeradmin4浏览0评论

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

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

Share Improve this question asked Jul 5, 2021 at 21:41 derekbaker783derekbaker783 9,5914 gold badges43 silver badges59 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

I was able to work around this issue by adding "skipLibCheck": true to my tsconfig.

TFM: https://www.typescriptlang/tsconfig#skipLibCheck

This is a known bug: https://github./facebook/jest/issues/11640

Downgrading to @types/node v15.14.0 seems to work around the bug for me.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论