I'm working on a simple API for a website in TypeScript, the code works well but I've a circular dependency that I need to fix.
A (very) minimal example of the project can be found here: https://codesandbox.io/s/dreamy-perlman-lpq6gh
Which is the best way to fix circular dependency of api/index.ts in this example?
I've tried to use an inherit class, but I don't know the best way to call a class child from another child.
Thanks!
CodePudding user response:
Firstly run the following cli command to get a list of circular dependencies, then you will notice what to do: Further instruction for madge here
npx madge --circular --extensions ts ./