0
我有一个角度为2 beta 8的项目,它有吞咽工作。Angular2 beta 8包含来自node_modules的Typescript定义文件
问题是,当gulp-typescript无法检查类型。 吞气任务如下:
gulp.task('ts', function() {
gulp.src('app/**/*.ts')
.pipe(ts({
target: 'ES6',
emitDecoratorMetadata: true,
experimentalDecorators: true
}))
.pipe(rename({ extname: '' }))
.pipe(traceur({
modules: 'instantiate',
moduleName: true,
annotations: true,
types: true,
memberVariables: true
}))
.pipe(rename({ extname: '' }))
.pipe(gulp.dest('build'))
})
我编译第一个ES6,以及使用事业打字稿后traceur显示更少的错误。 我秀壳日志:
[19:23:37] Using gulpfile ~/front/gulpfile.js
[19:23:37] Starting 'dependencies'...
[19:23:37] Finished 'dependencies' after 15 ms
[19:23:37] Starting 'ts'...
[19:23:37] Finished 'ts' after 5.96 ms
[19:23:37] Starting 'html'...
[19:23:37] Finished 'html' after 1.15 ms
[19:23:37] Starting 'default'...
[19:23:37] Finished 'default' after 3.13 μs
app/app.ts(1,28): error TS2307: Cannot find module 'angular2/platform/browser'.
app/components/component.ts(1,25): error TS2307: Cannot find module 'angular2/core'.
[19:23:39] TypeScript: 2 semantic errors
[19:23:39] TypeScript: emit succeeded (with errors)
我不知道我怎么能包括打字稿定义文件。 我试图添加此文件到gulp.src
,如:
gulp.src(['app/**/*.ts', 'node_modules/angular2/**/*.d.ts)
但显示:重复的定义文件中的错误。
我甚至尝试添加输入选项的package.json,如:
"typings": 'node_modules/angular2/platform/browser.d.ts'
但这个文件有,这不是递归检测进口。
所以...任何意见?
角的最后几个版本包含angular2.d.ts,但没有。我不会不知所措,为什么我应该使用打字稿定义文件,而不管打字稿是否使用打字稿。
是否有可能从node_modules导入角打字稿并通过打字稿编译器进行编译?