4 ms·
Yeah I could definitely do this, and maybe should. But the issue is so systemic due to the bad generated types that this would cloud the code without much added
by dmitryminkovsky 5y ago
Yeah I could definitely do this, and maybe should. But the issue is so systemic due to the bad generated types that this would cloud the code without much added benefit.
- renke1 5y agoI had my own share of problems with generated code, so I feel you. I often use that utility when I have some type where under certain condition a value will always be defined, but a union type would make it too complex to be useful.
- dmitryminkovsky 5y agoYeah in my case I am using Postgres via Hasura, which exposes the Postgres DB via a GraphQL API, which in turn can be used to generate types. Unfortunately the nullability of fields in a Postgres view cannot be determined, so all fields in the corresponding types are nullable [0], even if they aren’t in the actual underlying table. So I end up using ! a lot because I know the field is non null in Postgres. It’s a unfortunate. [0] https://github.com/hasura/graphql-engine/issues/1965 https://github.com/hasura/graphql-engine/issues/1965