Skip to content

Ignore same-name definitions #217

Open
@nycdotnet

Description

@nycdotnet

It would be nice to have an option to ignore same-name definitions. For example, consider the following default gruntfile.js with the declaration option enabled:

module.exports = function(grunt) {
  grunt.initConfig({
    ts: {
      default : {
        src: ["**/*.ts", "!node_modules/**/*.ts"],
        options: {
            declaration: true
        }
      }
    }
  });
  grunt.loadNpmTasks("grunt-ts");
  grunt.registerTask("default", ["ts"]);
};

Assuming there is a file called foo.ts, this will work fine the first time it is called and compile foo.ts to foo,js, foo.js.map, and foo.d.ts. However, the second time it runs, the glob will capture both foo.ts and foo.d.ts and the result is likely to be error TS2300: Duplicate identifier errors.

Suggested enhancement: if options: declaration is turned on, the default behavior should be to ignore foo.d.ts if foo.ts is being compiled. There should be an option to not ignore the same-name definition files.

when out or files is being used (basically if --out is being passed to tsc), the output js file minus the js extension plus the d.ts extension should be auto-ignored.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions