timhall / svelte-apollo

Svelte integration for Apollo GraphQL
MIT License
947 stars 68 forks source link

Un-shadow fundamental Error type #83

Closed jan-musi closed 2 years ago

jan-musi commented 3 years ago

When ReadableResult is in its error state, the error it provides at runtime can be either an ApolloError (from @apollo/client) or an Error (the fundamental type).

However, because the ReadableResult's error interface is named Error, its error state (accidentally?) defines its provided error in TypeScript as either an ApolloError or its own error state (recursively).

Screen Shot 2021-02-17 at 7 51 41 AM

I believe the simplest solution to this is to rename the error state's interface - I've proposed ReadableError here, but I defer to your judgement on what name is best.

Thank you!

timhall commented 2 years ago

Thanks for this 👍 , sorry it made it to the 1-year anniversary 😞