apollographql/apollo-link

graphQLErrors type is incorrect

Opened this issue · 0 comments

Expected Behavior
Expected

graphQLErrors?: ReadonlyArray<GraphQLError>;
to be the correct type.

Actual Behavior
The referenced type from graphql tells the compiler that GraphQLError extends Error and objects in the graphQLErrors array are instance of the GraphQLError class.

This is because that error class is only used on the server AFAICT, and we don't instantiate instances of this object on the client.

I think we should have a type that just represents the structure of the JSON response and doesn't claim to extend Error.

A simple reproduction
error instanceof GraphQLError || error instanceof Error is false.