Working on a project using Angular 2 + PrimeNG, I encountered an issue with TypeScript compilation while trying to use Git. The solution involved adjusting the package.json file.
"dependencies": {
"@angular/common": "2.4.2",
// List of dependencies goes here...
},
"devDependencies": {
// List of dev dependencies goes here...
}
After cloning the project repo, installing all npm packages, and attempting to build the project, I encountered a series of errors during compilation (here is a snippet of the error log).
ERROR in [at-loader] ./node_modules/@angular/router/src/utils/collection.d.ts:35:58
TS2304: Cannot find name 'Promise'.
// More error messages go here...
The issue stemmed from not recognizing es5 types. My tsconfig.json file looked like this:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
// Other options are defined here...
}
}
To address the problem, I switched the TS compiler to es6 mode by changing "target": "es6". However, this resulted in another set of errors:
ERROR in [at-loader] ./node_modules/@types/handlebars/index.d.ts:22:77
TS2314: Generic type 'HandlebarsTemplateDelegate<T, any>' requires 2 type argument(s).
// Additional error messages...
It seems that the project was not properly configured to handle es6 types. How can I correctly configure the project for es6 compilation?