Multiple Typescript modules without duplicate identifier errors

I split the project into several bower modules, all of which should reference the underscore.d.ts file

- bower_components
 |- module_a
    |- src
       |- externl-commonjs.ts
 |  |- typings
 |     |- underscore
 |- module_b
    |- src
       |- externl-commonjs.ts
    |- typings
       |- underscore
- src
  |- externl-commonjs.ts
- typings
  |- underscore

I can compile module_a and module_b myself ... but when they are in a project like the one above, I get duplicate identifier errors due to the multiple /// <referencein underscore.d.ts in each external module file.

How would you work on this and have a single source of truth for underscore.d.ts.

+4
source share
3 answers

I solved this using https://github.com/TypeStrong/grunt-dts-bundle , which will create d.ts from all the internal code, but not directly link to any external definitions.

.

0

, , ///<amd-dependency path="foo" name="foo">, declare var foo; amd ( , ), Tsc . , . AMD, .

grunt ts , grunt-exec. , ts ts .

0

All Articles