-
-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Circular dependency issue when using functional syntax #1449
Comments
|
Does it work if you remove |
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? |
This issue prevents me from using TypeGraphQL with NextJS. NextJS tries to do its magic with optimization and it breaks with |
Maybe I'm late to the party but that's how I fixed it: I have somewhere in my app a function
Now in my file where I need a reference of that dto that have circular dependency with another I do this city.ts
country.ts
|
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:
The text was updated successfully, but these errors were encountered: