Ich habe eine JavaScript-App, die aus mehreren .js-Dateien und einer .ts-Datei besteht. Ich verwende die neueste Version von TypeScript mit seinem allowJs-Flag. Ich möchte, dass meine App mit einem Schluck Aufgabe kompilieren, aber ich halte diese Fehler bekommen:Konfigurieren von Typings mit Schluck-Typoskript
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'.
Hier mein typings.json ist:
{
"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"
}
}
Mein tsconfig.json:
{
"compilerOptions": {
"allowJs":true,
"noLib": false,
"target":"ES5"
}
}
Auszug meiner 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);