2016-05-15 8 views
0

Ich habe wenig Probleme mit dem Kompilieren von Typoskript mit Schluck. Ich habe ausschließen Verzeichnis in meinem TSconfig gesetzt, aber ich bin immer * .d.ts Fehler:Typescript express - Schluck exclude Kompilierfehler

typings/browser/ambient/node/index.d.ts(1965,18): error TS2300: Duplicate identifier 'Transform'. 
typings/browser/ambient/node/index.d.ts(1987,18): error TS2300: Duplicate identifier 'PassThrough'. 
typings/browser/ambient/node/index.d.ts(1992,9): error TS2300: Duplicate identifier 'showHidden'. 
typings/browser/ambient/node/index.d.ts(1993,9): error TS2300: Duplicate identifier 'depth'. 
typings/browser/ambient/node/index.d.ts(1994,9): error TS2300: Duplicate identifier 'colors'. 
typings/browser/ambient/node/index.d.ts(1995,9): error TS2300: Duplicate identifier 'customInspect'. 
typings/browser/ambient/node/index.d.ts(2056,5): error TS2300: Duplicate identifier 'export='. 
typings/browser/ambient/node/index.d.ts(2064,9): error TS2300: Duplicate identifier 'isRaw'. 
typings/browser/ambient/node/index.d.ts(2066,9): error TS2300: Duplicate identifier 'isTTY'. 
typings/browser/ambient/node/index.d.ts(2069,9): error TS2300: Duplicate identifier 'columns'. 
typings/browser/ambient/node/index.d.ts(2070,9): error TS2300: Duplicate identifier 'rows'. 
typings/browser/ambient/node/index.d.ts(2071,9): error TS2300: Duplicate identifier 'isTTY'. 
typings/browser/ambient/node/index.d.ts(2078,18): error TS2300: Duplicate identifier 'Domain'. 
typings/browser/ambient/serve-static/index.d.ts(85,5): error TS2300: Duplicate identifier 'export='. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/body-parser/index.d.ts(138,5): error TS2300: Duplicate identifier 'export='. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(22,9): error TS2300: Duplicate identifier 'path'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(23,9): error TS2300: Duplicate identifier 'stack'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(81,9): error TS2300: Duplicate identifier 'all'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(82,9): error TS2300: Duplicate identifier 'get'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(83,9): error TS2300: Duplicate identifier 'post'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(84,9): error TS2300: Duplicate identifier 'put'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(85,9): error TS2300: Duplicate identifier 'delete'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(86,9): error TS2300: Duplicate identifier 'patch'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(87,9): error TS2300: Duplicate identifier 'options'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(88,9): error TS2300: Duplicate identifier 'head'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(107,9): error TS2300: Duplicate identifier 'ma 
ge'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(108,9): error TS2300: Duplicate identifier 'signed'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(109,9): error TS2300: Duplicate identifier 'expires'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(110,9): error TS2300: Duplicate identifier 'httpOnly'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(111,9): error TS2300: Duplicate identifier 'path'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(112,9): error TS2300: Duplicate identifier 'domain'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(113,9): error TS2300: Duplicate identifier 'secure'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(145,9): error TS2300: Duplicate identifier 'headers'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(242,9): error TS2300: Duplicate identifier 'accepted'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(293,9): error TS2300: Duplicate identifier 'protocol'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(300,9): error TS2300: Duplicate identifier 'secure'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(307,9): error TS2300: Duplicate identifier 'ip'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(317,9): error TS2300: Duplicate identifier 'ips'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(330,9): error TS2300: Duplicate identifier 'subdomains'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(335,9): error TS2300: Duplicate identifier 'path'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(340,9): error TS2300: Duplicate identifier 'hostname'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(345,9): error TS2300: Duplicate identifier 'host'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(352,9): error TS2300: Duplicate identifier 'fresh'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(359,9): error TS2300: Duplicate identifier 'stale'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(364,9): error TS2300: Duplicate identifier 'xhr'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(367,9): error TS2300: Duplicate identifier 'body'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(370,9): error TS2300: Duplicate identifier 'cookies'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(372,9): error TS2300: Duplicate identifier 'method'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(374,9): error TS2300: Duplicate identifier 'params'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(376,9): error TS2300: Duplicate identifier 'user'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(378,9): error TS2300: Duplicate identifier 'authenticatedUser'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(388,9): error TS2300: Duplicate identifier 'query'. 
/Users/petrtomasek/Projects/expressTypescript/typings/main/ambient/express-serve-static-core/index.d.ts(390,9): error TS2300: Duplicate identifier 'route'. 

Dies ist nur ein Teil des Fehlers ist, aber alles ist aus demselben Ordner. Mein gulpfile:

var tsProject = ts.createProject('tsconfig.json', { typescript: require('typescript') }); 

gulp.task('Build_typescript', function() { 
return tsProject.src([paths.typescriptDir + "*.ts", "!" + paths.documentRoot + "baseDir.ts", "!" + paths.documentRoot + "_all.d.ts"]) 
    .pipe(plumber()) 
    .pipe(sourcemaps.init()) 
    .pipe(ts(tsProject)) 
    .pipe(debug()) 
    .pipe(sourcemaps.write(".")) 
    .pipe(gulp.dest(".")); 
}); 

und TSconfig mit ES5 von Angular2:

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "noImplicitAny": false 
    }, 
    "exclude": [ 
    "node_modules", 
    "typings/main", 
    "typings/main.d.ts" 
//"typings/browser", 
//"typings/browser.d.ts" 
    ] 
} 

Alle Referenzen meine * .d.ts ich in einer Datei haben _all.d.ts:

/// <reference path="../node_modules/typescript/lib/typescript.d.ts" /> 
/// <reference path="../typings/browser.d.ts" /> 
/// <reference path="../typings/main.d.ts" /> 

brow ser:

/// <reference path="browser/ambient/body-parser/index.d.ts" /> 
/// <reference path="browser/ambient/express-serve-static-core/index.d.ts" /> 
/// <reference path="browser/ambient/express/index.d.ts" /> 
/// <reference path="browser/ambient/mime/index.d.ts" /> 
/// <reference path="browser/ambient/node/index.d.ts" /> 
/// <reference path="browser/ambient/serve-static/index.d.ts" /> 

Haupt:

/// <reference path="main/ambient/body-parser/index.d.ts" /> 
/// <reference path="main/ambient/express-serve-static-core/index.d.ts" /> 
/// <reference path="main/ambient/express/index.d.ts" /> 
/// <reference path="main/ambient/mime/index.d.ts" /> 
/// <reference path="main/ambient/node/index.d.ts" /> 
/// <reference path="main/ambient/serve-static/index.d.ts" /> 
/// <reference path="main/mongoose/mongoose.d.ts" /> 

In meinem Projekt, nenne ich refefences auf der Datei:

/// <reference path="../_all.d.ts" /> 

import mongoose = require("mongoose"); 

export var userSchema = new mongoose.Schema({ 
    name: String 
}); 

export interface IUser extends mongoose.Document { 
    name: string; 
} 

export var repository = mongoose.model<IUser>("Userma"); 

ich nicht wirklich wissen, wo ist ein Problem. Code ist ohne andere Fehler (nur diese d.ts-Dateien).

Können Sie mir helfen, was ist los? Vielen Dank!

Antwort

0

In Ihrer _all.d.ts benötigen Sie keinen Verweis auf browser.d.ts, da beide dieselben Definitionen enthalten und daher doppelte Fehler bei der Bezeichnererkennung auftreten.

/// <reference path="../node_modules/typescript/lib/typescript.d.ts" /> 
/// <reference path="../typings/main.d.ts" /> 
+0

Ja, es war ein Fehler mit Kommentar. Ich habe nur diese zwei Zeilen. Es gibt kein Problem. –

+0

gut, dass Sie das Problem gelöst .. –

+0

Ich habe nicht. Aber Referenzen Zeile ist nicht das Problem. –