[SG-29452] Do not skip `__typename` generation `graphql-codegen`
Created by: gitstart-sourcegraph
Description
- Because of bringing back
__typename
for every types, so CodeGen is usingunion
types with__typename: "..."
, so there are a lot of "empty" type since it contains only{ __typename?: '...' }
together with only one type contains the query result we expected (See the screenshot for diffs between old vs new code-gen results)
To fix TS build issue, we can add __typename
checks, Typescript would automatically refine types
But in the end, keeping using union types
like that is not a good idea at all
Refs
- sourcegraph/sourcegraph#24644