node_modules/@ types/babel _template/index.d.ts:16:28-错误TS2583:找不到名称'Set' [英] node_modules/@types/babel _template/index.d.ts :16:28 - error TS2583: Cannot find name 'Set'

查看:381
本文介绍了node_modules/@ types/babel _template/index.d.ts:16:28-错误TS2583:找不到名称'Set'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了本文设置TypeScript NPM软件包. 我第一次运行npm run build(在安装jest之前).进行得非常顺利.之后,我安装了jest,然后再次运行npm run build,下面出现了错误消息:

I followed this article to set up a TypeScript NPM package. The first time I ran npm run build(before install jest). It went really well. After that I installed jest and then I ran npm run build again, I’ve got a error message below:

tsc node_modules/@types/babel__template/index.d.ts:16:28-错误TS2583:找不到名称设置".您是否需要更改目标库?尝试将lib编译器选项更改为es2015或更高版本.

tsc node_modules/@types/babel__template/index.d.ts:16:28 — error TS2583: Cannot find name ‘Set’. Do you need to change your target library? Try changing the lib compiler option to es2015 or later.

16个placeholderWhitelist ?:设置;

16 placeholderWhitelist?: Set;

发现1个错误.

我的节点npm,tsc版本是:node -v//v8.12.0,npm -v//v6.4.1,tsc -v//v3.4.5

My node, npm, tsc version is: node -v // v8.12.0, npm -v // v6.4.1, tsc -v // v3.4.5

这是tsconfig.json

Here is tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": true,
    "outDir": "./lib",
    "strict": false
  },
  "include": ["./src"],
  "exclude": ["node_modules", "**/__tests__/*"]
}

我已经在tsconfig.json中排除了"node_modules",为什么tsc仍然运行node_modules?

I already excluded "node_modules" in tsconfig.json, how come tsc still ran node_modules?

推荐答案

tsconfig .json

默认情况下,所有可见的@types软件包均包含在您的编译中.任何封闭文件夹的node_modules/@types中的软件包都被视为可见;具体来说,这意味着./node_modules/@types/../node_modules/@types/../../node_modules/@types/等内的软件包.

By default all visible @types packages are included in your compilation. Packages in node_modules/@types of any enclosing folder are considered visible; specifically, that means packages within ./node_modules/@types/, ../node_modules/@types/, ../../node_modules/@types/, and so on.

这篇关于node_modules/@ types/babel _template/index.d.ts:16:28-错误TS2583:找不到名称'Set'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆