-
I've been using graphql-mesh in production for a little while now, and one incredibly frustrating thing I keep running into is TypeScript issues due to generated nullable types that really shouldn't be nullable? I use the type Query implements Node {
crm: crmQuery
user: userQuery
xxx: xxxQuery
...
} Which is great for keeping things organized. But EVERY time I try to query anything I end up with Typescript errors saying that e.g. When I try to access anything on any of my sources. Every single time I use it I either have to use a typescript And I realized, that the encapsulate transform is making all of my encapsulate fields nullable? I don't understand why it would do that since it's impossible to query any of these fields without also getting their subFields. e.g. if I try to query: query {
crm
}
} I get an expected good error:
So why does the The Typescript is correctly creating the following type: export type Maybe<T> = T | null
export interface Query {
__typename?: 'Query'
crm?: Maybe<crmQuery>
user?: Maybe<userQuery>
} Is there anyway I can override the graphql schema to make these non nullable and get my sanity back? E.g. The schema SHOULD be like this: type Query implements Node {
crm: crmQuery!
user: userQuery!
xxx: xxxQuery!
...
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You are right, wrapper types should be non-null since they have those fields no matter what. Fix is on the way. |
Beta Was this translation helpful? Give feedback.
You are right, wrapper types should be non-null since they have those fields no matter what. Fix is on the way.