Open zacharyclaysmith opened 1 year ago
type: module
is not currently supported in V2 beta until PR #1400 is merged.
I think this is the main cause of the issue 🙃
Does it work if you remove type: module
?
Tried it in this branch: https://github.com/zacharyclaysmith/type-graphql-circular-dependency-repro/tree/remove-type-module
It caused some cascading issues that had to be addressed (changing to commonjs and rewriting the index.ts file to not have a top-level await), but I think it technically works. I'll try similar in my actual application, though it's likely to not be as easy to solve with other major libraries in play.
Now getting "TypeError: Class extends value undefined is not a constructor or null" in my main application after trying to make those changes (I'm using interfaces there that I didn't include in my original example). I'll see if I can recreate the issue in the example repo.
Hello all,
I have the same issue with my setup in 2.0.0-rc2. Unfortunately, all the things in my monorepo are modules and it's very undesirable to change.
Is there any workaround which allows to stay on module?
Describe the Bug A ReferenceError is thrown at startup due to circular references. These circular references occur while using the
@Field(type => SomeType)
syntax.To Reproduce Example Repository: https://github.com/zacharyclaysmith/type-graphql-circular-dependency-repro
(Key code extracts in Additional Context below)
Expected Behavior The "functional syntax" should keep this kind of issue from happening:
From https://typegraphql.com/docs/0.17.1/types-and-fields.html:
Logs If applicable, add some console logs to help explain your problem. You can paste the errors with stack trace that were printed when the error occurred.
Environment (please complete the following information):
Additional Context This example was recreated from a larger project where I'm running into this issue. I tried to remove any unnecessary cruft when copying over pieces of code/dependency lists.
The original project also uses mikro-orm, and I avoid circular dependencies with their library due to the ability to use a string version of the type name, e.g.
@Property('User')
.Key Code extracts: