-
Notifications
You must be signed in to change notification settings - Fork 343
Description
Type systems are completely independent of the Javascript runtime and really don't matter because they don't influence runtime module imports, since they are only used by the statically run type system and even circular dependencies don't matter at all since nothing is executed.
madge interprets "import type" statements as module imports and Javascript module dependencies, but that is not true. I get a completely different result when I let it run on ./src/ compared to my after-built (i.e. all type annotations stripped) ./lib/.
Madge could either ignore "import type" or use "flow-remove-types" (https://github.com/flowtype/flow-remove-types).
Yes I know, the simple workaround is to just run madge on the build JS files instead of the sources. Still, I'm not sure how many people don't think about this and end up with an overly complicated dependency graph that does not reflect the actual module loading dependencies. Maybe a note in the README should mention this. Not sure about TypeScript, it's more complicated, I guess that can only be dependency-parsed after built anyway?