I managed to fix this issue without having to add any triple-slash reference to the TS bootstrap file, change to ES6 (which brings a bunch of issues, just as @DatBoi said) update VS2015's NodeJS
and/or NPM
bundled builds or install typings
globally.
Here's what I did in few steps:
typings
in the project's package.json
file.script
block in the package.json
file to execute/update typings
after each NPM action.typings.json
file in the project's root folder containing a reference to core-js
, which is one of the best shim/polyfill packages out there at the moment to fix ES5/ES6 issues.Here's how the package.json
file should look like (relevant lines only):
{
"version": "1.0.0",
"name": "YourProject",
"private": true,
"dependencies": {
...
"typings": "^1.3.2",
...
},
"devDependencies": {
...
},
"scripts": {
"postinstall": "typings install"
}
}
And here's the typings.json
file:
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160621231320"
}
}
(Jasmine
and Node
are not required, but I suggest to keep them in case you'll need to in the future).
This fix is working fine with Angular2 RC1 to RC4, which is what I needed, but I think it will also fix similar issues with other ES6-enabled library packages as well.
AFAIK, I think this is the cleanest possible way of fixing it without messing up the VS2015 default settings.
For more info and a detailed analysis of the issue, I also suggest to read this post on my blog.