Can not find name Promise , Set , Map, Mapconstructor , Setconstructor or Iterator in angular 2.
Angular 2
Can not find name Promise , Set , Map, Mapconstructor , Setconstructor or Iterator in angular 2.
It is a frequent error that we get when we tried to compile the Angular 2 application . These above issues are raised due to so many factors.
But in my case it was just happened due to tsconfig.json file configuration settings.
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main.d.ts",
"typings/main"
]
}
I checked so many post or articles but not able to fix my issue . So eventually I got the solution and it seems that the issue is raised in declarations file due to the Javascript typings mismatching . So I changed the "target": "es5" to "es6" and it works fine for me.
So the new tsconfig.json file will be
{
"compilerOptions": {
"target": "es6",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main.d.ts",
"typings/main"
]
}
Hope this will be helpful . Let me know if you have any issue .
Can not find name Promise , Set , Map, Mapconstructor , Setconstructor or Iterator in angular 2.
It is a frequent error that we get when we tried to compile the Angular 2 application . These above issues are raised due to so many factors.
But in my case it was just happened due to tsconfig.json file configuration settings.
Basically our common tsconfig,json file contains the following properties like
{"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main.d.ts",
"typings/main"
]
}
I checked so many post or articles but not able to fix my issue . So eventually I got the solution and it seems that the issue is raised in declarations file due to the Javascript typings mismatching . So I changed the "target": "es5" to "es6" and it works fine for me.
So the new tsconfig.json file will be
{
"compilerOptions": {
"target": "es6",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main.d.ts",
"typings/main"
]
}
Hope this will be helpful . Let me know if you have any issue .
Correct :)
ReplyDelete