Question: TypeGraphQL uses functions to prevent circular dependencies-wouldn't this package's API suffer from the same problem?
See original GitHub issuethe quote from: https://19majkel94.github.io/type-graphql/docs/types-and-fields.html
Why function syntax, not simple { type: Rate } config object? Because this way we solve problems with circular dependencies (e.g. Post <--> User), so it was adopted as a convention. You can use the shorthand syntax @Field(() => Rate) if you want to safe some keystrokes but it might be less readable for others.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
MichalLytek/type-graphql - Support for circular references
A workaround exists for graphql js by using a function for a field's resolve ... you can encounter the same issue when you...
Read more >Frequently Asked Questions - TypeGraphQL
This error occurs when the resolver (query, mutation, field) type is an interface/union and a plain object is returned from it. In this...
Read more >GraphQL circular dependency - Stack Overflow
According to this article graphQL does somewhat increase issues with circular dependency. The article suggests using extend type for ...
Read more >GraphQL vs. REST APIs: Why you shouldn't use GraphQL
Cover some scenarios in which using GraphQL could lead to performance issues and problems related to schemas and complex queries.
Read more >Build a GraphQL Twitter API Clone with TypeScript ... - YouTube
In this video, we will build a clone of the Twitter API, where users can register, follow & unfollow other users, as well...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @capaj @19majkel94 .
Right, if you’ve got circular dependencies you’d have to use type lazy function like:
Note it might be not needed anymore if typescript itself would make reflection metadata lazy in its core.
@capaj I’ve proposed that a long time ago: https://github.com/indigotech/graphql-schema-decorator/issues/65#issuecomment-370560844
But since that time our visions have splited - this is what @pie6k said:
So I think it’s better when users have an ability to choose between library vs. framework and also the competition makes the development faster 😄