1

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!

secdef
  • 13
  • 1
  • 4
  • 1
    Does this answer your question? [Circular Type References in TypeScript](https://stackoverflow.com/questions/24444436/circular-type-references-in-typescript) – Matt Sep 10 '22 at 02:59
  • No really. I thought about using a third file but I don't like that solution. Thanks anyway! – secdef Sep 10 '22 at 05:14

1 Answers1

3

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 ./
jmvcollaborator
  • 2,141
  • 1
  • 6
  • 17