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'
问题描述
我关注了本文设置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?
推荐答案
默认情况下,所有可见的@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屋!