Replies: 1 comment 4 replies
-
This is actually a big weakness in GCG: Correctness by default and the vast amount of configurability that is either needed to be more correct on type outputs, or the configuration that only makes types less correct. This is one such case. We make sure that all generated types follow a high level of correctness to the GraphQL spec's generated output and there's little wiggle room in that spec for a reason. To put it short, semantically having both In a GraphQL API's resolvers for instance, it doesn't matter much. Nullable fields are selected fields in the GraphQL API and must return either a value or There are some cases where GCG actually defaults to less correct type outputs and this can easily lead to mistakes, since the types don't convey the actual JSON type you'll get and don't convey the semantic difference in JS and GraphQL that you get. Once you enter presentational components that don't specify any colocated fragments you're of course free to convert and map to anything. |
Beta Was this translation helpful? Give feedback.
-
Other codegen based typescript graphql clients have support for customizing the generated
Maybe
type (See typescript-operations).I think it makes sense to support something similar in gql.tada.
I personally avoid
null
like the plague and prefer to useundefined
as my optional state. None of my UI code usesnull
, which makes integrating with agql.tada
client really awkward since I have to constantly transform nulls to undefined manually.Beta Was this translation helpful? Give feedback.
All reactions