I've just completed the Angular 2.0 Tour of Heroes tutorial and I've added the following Gulp file (simplified for this example) to build it:
var del = require('del');
var gulp = require('gulp');
var ts = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var tsProject = ts.createProject('tsconfig.json');
gulp.task('transpile-ts', function() {
var tsResult = gulp.src(paths.allTypeScript)
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
return tsResult.js
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.dest_js));
});
I want to add an Array.find method into dashboard.component.ts as follows:
ngOnInit() {
let newVar: Array<number> = new Array();
newVar.push(0);
newVar.push(1);
newVar.find(d => d == 1);
this._heroService.getHeroes()
.then(heroes => this.heroes = heroes.slice(1,5));
}
When I run the command "gulp transpile-ts" however I get the following error:
app\dashboard.component.ts(26,16): error TS2339: Property 'find' does not exist on type 'number[]'.
I have es6-shim.d.ts included so the "find" method does exist under "interface Array".
Also I tried running the same task with Grunt and the same issue occurred so it's not a Gulp issue.
Any ideas as to what could be causing this?