Open ziriax opened 4 years ago
This seems an anti-pattern yet it's accepted by TS engine. We should try to resolve this.
Similar: Noticed we had a lot of false-positives for cycles running madge where only a TS Interface is imported as well. Our are usually export interface ITypeOfThing {...}
along side an export of a concrete thing, e.g. a React component props interface, alongside a component definition. We don't have the problem with the names being identical, but madge still didn't seem to differentiate a types-only import from a real-code import.
any updates?
We use the following pattern a lot in our Typescript code:
The Typescript compiler wants these to be in the same file.
(Originally we used namespaces for this, but babel doesn't support these fully yet, and the same problem would exist if it it)
When importing the
person
module and using only thePerson
type, so not thePerson
object variable,madge
still considers this as a cyclic dependency, even though the resulting Javascript code doesn't have any cycles anymore (as far as know).The Typescript compiler has no problems with these cyclic type imports.
This seems pretty hard to solve, but reporting it anyway...