Apollo's documentation explains that an error response can take the following form:
{
"data": {
"getInt": 12,
"getString": null
},
"errors": [
{
"message": "Failed to get string!",
// ...additional fields...
}
]
}
How do I go about importing the type(script) definition for this response?
If we were to define the type, it might look like this:
type ApolloError = {
data?: {
getInt?: number,
getString?: string | null
},
errors: { message: string, ... }[]
}
I'm thinking the import statement would be something along the lines of:
import type { Error } from 'some-apollo'
Alternatively, could a development package like '@types/apollo` handle this globally?