我有一个由多个.js文件和一个.ts文件组成的JavaScript应用程序。我使用带有allowJs标志的最新版本的TypeScript。我想使用吞咽任务来编译我的应用程序,但我一直收到以下错误:
x:/XXX/typings/main/ambient/angular/index.d.ts(65,35): error TS2304: Cannot find name 'Element'.
x:/XXX/typings/main/ambient/angular/index.d.ts(65,50): error TS2304: Cannot find name 'Document'.这是我的typings.json:
{
"ambientDependencies": {
"angular": "registry:dt/angular#1.5.0+20160318102130",
"d3": "registry:dt/d3#0.0.0+20160317120654",
"jquery": "registry:dt/jquery#1.10.0+20160316155526"
}
}我的tsconfig.json:
{
"compilerOptions": {
"allowJs":true,
"noLib": false,
"target":"ES5"
}
}摘录我的gulpfile
var tsProject = plugins.typescript.createProject('tsconfig.json');
var pathsSrc = {
ts: [ "typings/main.d.ts", 'client/app/**/*.js', 'client/app/**/*.ts', '!**/nameOfMyOnlyTsFile.js']}
function ts() {
return gulp.src(pathsSrc.ts)
.pipe(plugins.typescript(tsProject))
.pipe(plugins.concat('xxxxxx.js'))
.pipe(gulp.dest(pathsDest.js));
}
function tsWithNotification() {
return ts()
.pipe(plugins.notify({
title:"Gulp TS",
message: "TS copied successfully.",
onLast: true
}));
}
gulp.task('ts', tsWithNotification);发布于 2016-04-04 03:36:17
最后我瞄准了ES6,但我得到了一些新的错误。
error TS2318: Cannot find global type 'Iterable'.
error TS2318: Cannot find global type 'IterableIterator'.
error TS2318: Cannot find global type 'Iterator'.
error TS2318: Cannot find global type 'Symbol'.
error TS2468: Cannot find global value 'Symbol'.暂时放弃,稍后我将使用类...
https://stackoverflow.com/questions/36216901
复制相似问题