graphql-code-generator
graphql-code-generator copied to clipboard
A way to exculde Maybe<> type from a generated TS schema
Is your feature request related to a problem? Please describe.
For frontend we set maybeValue: T | undefined
in config and in this case it's not clear why we need Maybe
type at all, because TypeScript guides usually suggest to prefer optional types over T | undefined
.
For example user?: User
will work as good as user?: Maybe<User>
and of course better than if we specify avoidOptionals: true
.
With avoidOptionals
and typescript's strictNullChecks
turned on it'll throw an error if I don't specify user
for user: Maybe<User>
(which is right from TS perspective, but not right from actual usage cases – if some value is optional, I prefer to not specify it at all then to write { someValue: undefined }
).
Describe the solution you'd like
Add to config a way to exclude Maybe
type at all from all the optional value types.
Describe alternatives you've considered
No response
Is your feature request related to a problem? Please describe.
No response