SolvedDefinitelyTyped @types/node , Cannot compile : node_modules/@types/node/index.d.ts(50,14): error TS2687: All declarations of 'iterator' must have identical modifiers.

Since 7.0.8, when using

node_modules/@types/node/index.d.ts(50,14): error TS2687: All declarations of 'iterator' must have identical modifiers.

Our tsconfig :

{ "compilerOptions": { "target": "es5", "module": "amd", "sourceMap": true, "strictNullChecks": true, "noImplicitAny": false, "noImplicitReturns": true, "noImplicitThis": false, "noUnusedParameters": false, "noUnusedLocals": true, "experimentalDecorators": false, "emitDecoratorMetadata": false, "removeComments": true, "outFile": "../js/ts.js" }, "exclude": [ "node_modules", "../node_modules", "../../node_modules" ] }

Conflicts is between @types/node line 50 and @types/core-js, line 504 (iterator:Symbol)

43 Answers

✔️Accepted Answer

It seems like adding "skipLibCheck": true to my tsconfig.json removed the compiler errors. I'm not sure it's a good idea to not type-check against used libraries, though.

{
	"compilerOptions": {
		"skipLibCheck": true
	}
}

Other Answers:

i have the same issue.
Switch back to @types/node": "7.0.7" fixes the problem

@harrietsCreativeDabblets you should be able to include the following in your project's devDependencies (within ng-start/package.json):

"@types/node": "7.0.7"

Since this satisfies the jspm-config semver it will ensure your version of @types/node gets locked to 7.0.7. Note that if this did not satisfy the jspm-config semver, you would end up with duplicate definitions.

Ensure you delete your node_modules and npm i after modifying your projects package.json.

+1 same issue.

It looks like the conflict is because in core-js on line 504 there is a definition for iterator: symbol and in the node typings on line 54 there is a definition of readonly iterator: symbol changing either of these manually to match will get my project to compile.

More Issues: