Reputation: 17
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 — 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?: Set;
Found 1 error.
My node, npm, tsc version is: node -v // v8.12.0, npm -v // v6.4.1, tsc -v // v3.4.5
Here is tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": false
},
"include": ["./src"],
"exclude": ["node_modules", "**/__tests__/*"]
}
I already excluded "node_modules" in tsconfig.json
, how come tsc still ran node_modules?
Upvotes: 2
Views: 3678
Reputation: 1242
In my case I did not change project anyhow (seen that in GIT changes). Just installed nodejs into Windows 10 via npm and this error message popped on me when compiling Web project of ASP.NET application (that has nothing to do with node_modules!). The only working solution that worked for me was delete and update package:
Upvotes: 2
Reputation: 17
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.
Upvotes: 0
Reputation: 8652
Try to add the "lib": ["es6"]
or higher and change the "target": "es6"
in the compilerOptions
"compilerOptions": {
"target": "es6",
"lib": ["es6"],
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": false
}
Upvotes: 0