Skip to content

[SG-29452] Do not skip `__typename` generation `graphql-codegen`

Administrator requested to merge SG-29452 into main

Created by: gitstart-sourcegraph

Description

  • Because of bringing back __typename for every types, so CodeGen is using union 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)

image

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

Merge request reports

Loading