The generated code collapses the different possible errors into a single error property in the response:
From the test spec:
|
error: data?.error ?? data?.errors ?? null, |
In that line of code:
data?.error is of type: Apollo.ApolloError | undefined
data?.errors is of type: ReadonlyArray<GraphQLError> | undefined
- and both are nullish coalesced into
null
The resulting type should be a compound type of those possibilities. However, the generated code incorrectly types this as error?: Apollo.ApolloError:
|
`export type PageFeedComp = React.FC<{data?: FeedQuery, error?: Apollo.ApolloError}>;` |
Expected Behavior
- Generated code types
error as Apollo.ApolloError | readonly GraphQLError[] | null.
The generated code collapses the different possible errors into a single error property in the response:
From the test spec:
graphql-codegen-apollo-next-ssr/test/index.spec.ts
Line 224 in 5370c8f
In that line of code:
data?.erroris of type:Apollo.ApolloError | undefineddata?.errorsis of type:ReadonlyArray<GraphQLError> | undefinednullThe resulting type should be a compound type of those possibilities. However, the generated code incorrectly types this as
error?: Apollo.ApolloError:graphql-codegen-apollo-next-ssr/test/index.spec.ts
Line 229 in 5370c8f
Expected Behavior
errorasApollo.ApolloError | readonly GraphQLError[] | null.