mobxjs/mst-gql

Circular dependency on scaffolding

mfasanya opened this issue · 1 comments

Getting an issue 'Cannot access X before initialization'

I believe this is due to the auto generated files having a circular dependency. Is there a way to merge all the base files into one file to help fix this issue?

When looking through other issues in mst-gql you could find @jkolyer's script https://gist.github.com/jkolyer/d2577a524f632953f5ff409aa3ec721f

I've made a fork and updated the script so I don't have to do any manual work:
https://gist.github.com/krstns/761a9f2a1f06627904e0db3289ab6cb0

Unfortunately, if you have a log of models you will eventually hit: TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

(I'm now struggling with it).

After a recent update of.. most likely node, or something else I started to get new series of errors and most likely will have to update that script accordingly.

If you are only starting your project and trying to use mst-gql please bear in mind it's not suitable for projects with a lot of models.