-1

I am working on nodejs application in typescript with angular which is also in typescript. i have use gulp to transpile the files to js. but when i run command to transile my angular file it gives me error TS2300: Duplicate identifier

enter image description here

here is my gulp.config.js

module.exports = function () {
    var config = {
        allTs:'./src/**/*.ts',
        typeings:'./typings/**/*.ts',
        server:'./server.ts',
        tsOutPutPath:'./app',
        allNgTs:'./client/**/*.ts',
        ngOut:'./public/scripts/src'
    };
    return config;
}

here is my gulp task

gulp.task('compile-ng', function () {

    var sourceTsFiles = [
        config.typeings,
        config.allNgTs
    ]

    del(['public/scripts/**/*.js','public/scripts/**/*.html']).then(paths => {
        console.log('Deleted files and folders:\n', paths.join('\n'));
    });
    var tsResult = gulp
        .src(sourceTsFiles)
        .pipe(sourcemaps.init())
        .pipe(tsc(tsProject));

    return tsResult.js
        .pipe(sourcemaps.write('../map'))
        .pipe(gulp.dest(config.ngOut));
});
4

2 に答える 2

-1

ngTypeings:'./node_modules/angular2/typings/**/*.ts' を gulp.config.json ファイルに追加し、タイピングの代わりにタスクでこの angular2 タイピングを使用します

 var sourceTsFiles = [
        config.ngTypeings,
        config.allNgTs
    ]
于 2016-01-11T07:14:13.003 に答える