Improve compiler to deal with duplicate sources in project (caused by use of git submodules) #5889
Labels
Suggestion
An idea for TypeScript
Too Complex
An issue which adding support for may be too complex for the value it adds
We have a large TypeScript project using different git repositories to separate work domains inside the project. We tend to create separate repositories for self-contained modules and use those modules in other repositories using git submodules. This helps tremendously to reduce clutter and distribute work.
In our case some modules are used in many other repositories and those repositories are in turn used in other repositories. This sometimes leads to duplicate sources in projects using submodules which themselves depend on a common submodule. Assume the following example to clarify this:
In this case submodule C is a self-contained repository used as submodule in repositories A and B which in turn are used as submodules in our main project git. This results in duplicate sources for
c.ts
in the main project which can sometimes lead to compiler errors along the lines ofTypes have separate declarations bla bla
. See #5039 for an example (this feature request is a spin-off from the discussion in #5039 which proposes path mappings).This is because the TypeScript compiler treats the duplicate implementations of submodule C as separate implementations. Would it not be nice if the compiler detects those duplicate sources (by generating some sort of hash for each compiled source) and automatically maps subsequent sources to the first source already compiled? It would greatly improve the use of git submodules in TypeScript projects and prevents the formation of separate type declarations.
The text was updated successfully, but these errors were encountered: