Right now I am utilizing the tsc
compiler with the watch flag in the command prompt. It functions correctly, loading all definition files and successfully compiling each angular2 file. However, it is quite cumbersome to use via the shell window.
My objective is to create a gulp task that can compile any typescript file based on angular2 definitions. I have integrated gulp-typescript
, which appears to be user-friendly. Here is the code snippet:
var tsProject = $.typescript.createProject(paths.src + '/tsconfig.json');
gulp.task('typescript', function() {
gulp
.src([
paths.src + '/*.ts'
])
.pipe($.typescript(tsProject)).js
.pipe(gulp.dest(paths.tmp));
});
Here is the folder structure:
...
src/
---- app/
-------- ts/
------------ *.ts
---- typings/
-------- angular2/
------------ angular2.d.ts
------------ http.d.ts
-------- es6-promise/
------------ ...
-------- rx/
------------ ...
-------- tsd.d.ts
---- *.ts
---- tsconfig.json
gulpfile.js
...
The tsconfig file does not contain a files
list, so the compiler needs to check every ts file within the src
directory (at any level).
Upon invoking the task, I encounter the following errors:
error TS2307: Cannot find module 'angular2/angular2'.
error TS2307: Cannot find module 'angular2/http'.
How can I specify which d.ts
files the typescript compiler should utilize?