Grunt重复错误打字稿

时间:2016-03-12 18:19:20

标签: javascript node.js typescript gruntjs

我是TypeScript的新手,刚刚与Grunt建立了一个项目。编译时,我收到与TypeScript grunt-typescript文件夹相关的大量重复错误。任何建议将不胜感激!

<?php if (is_front_page() && !is_paged()
) $posts = query_posts($query_string . '&cat=-33,-66'); ?> 

这只是错误的一个子集,但它们似乎都是重复相关的!

干杯!

这是我的tsconfig.json文件,如果有任何帮助的话!

 Bens-MacBook-Pro:Chapter1 bendavies$ Grunt
 Running "watch" task
 Waiting...
 >> File "app.ts" changed.
 Running "typescript:base" (typescript) task
 >> node_modules/grunt-typescript/node_modules/typescript/lib/lib.core.d.ts(83,5): error TS2300: Duplicate identifier 'configurable'.

2 个答案:

答案 0 :(得分:0)

由于你没有包含你的tsconfig.json - 我猜你错过了排除node_modules文件夹。

尝试排除&#39;部分集如下例所示:

{ 
    "compilerOptions": { 
        "emitDecoratorMetadata": true, 
        "experimentalDecorators": true,
        "moduleResolution": "node",
        "module": "commonjs", 
        "target": "es6",
        "sourceMap": true,
        "outDir": "bin",
        "declaration": true
    },
    "exclude": [
        "node_modules",
        "typings/browser.d.ts",
        "typings/browser/**"
    ]
} 

答案 1 :(得分:0)

通过将GruntFile.js修改为更具体的源集来解决此问题。这是我现在使用的GruntFile!

module.exports = function(grunt){
grunt.loadNpmTasks('grunt-typescript');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    typescript: {
        base: {
            src: ['*.ts'],
            options:{
                module: 'commonjs',
                target: 'ea5',
                sourceMap: true

            }
        }
    },
    watch: {
        files: '*.ts',
        tasks: ['typescript']

    }
});

grunt.registerTask('default',['watch']);


}