I am using TypeScript with --module system(SystemJS) in a very large project. SystemJS supports circular dependencies, and most of the time it works fine. However, when TypeScript inherits, everything starts to break.
For example, if a class Adepends on class B, but class B inherits from class A, then if it class Aloads first:
- Permission will be suspended
class A'sand will try to load the dependencyclass B class Bwill think that his dependencies are allowed because he class Awas affected.class B'sInheritance will not be allowed because it class Ais still undefined.
Most of the “solutions” I can find on the Internet for circular dependencies with module loaders are:
- Change your design / merge classes into one module
- CommonJS and non-TypeScript workarounds
I feel that there are reasonable justifications for circular projects, and combining classes into giant files is not always desirable, so please consider these workarounds so as not to answer the question I ask.
Are there any solutions to the real problem?
Eric source
share