So I actually just ran into this using Mobx State Tree in a project.

I have a file that contains the MST models. That generates the TS types for me too. I have another API file that makes calls to a server. The response makes use of the TS type from the model file.

And then in the actions of the model file, I make the API request calls. A circular dependency with only 2 files. Surprisingly this hasn’t caused any issues though.

Written by

Founder: & Draft Fantasy. Full stack JavaScript Engineer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store