I have 'apollo-boost' installed. typescript generated this error:
Type 'AWSAppSyncClient<{}>' is not assignable to type 'ApolloClient<{}>'
I got rid of the error by specified the client as any before assigning to ApolloProvider
<ApolloProvider client={client as any}>
But why the types are incompatible?
I had the same issue. How to fix it in Angular ?
See wolfeidau/basic-ts-react-appsync for a reproduction.
Looks like this is caused by using multiple versions of apollo-link. Forcing Yarn to install a single version of the package seems to have resolved it for me.
This is also an issue in React. For an example see this: https://github.com/amaingot/todo/blob/1577e8533d7253f55826f11c9e6d6529faf68fb6/src/index.tsx#L28
Without as any, it runs into type errors.
Happening to me too -- https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/362#issuecomment-489510204
@johannchen ensure that your aws-appsync and apollo-client dependencies are in sync.
For instance, I'm using the following:
"aws-appsync": "^1.8.0",
"apollo-client": "2.4.6",
"react-apollo": "^2.5.5",
"aws-appsync-react": "^1.2.7",
and my code is as follows:
const apolloClient = new AWSAppSyncClient(options);
<ApolloProvider client={ apolloClient }>
<Rehydrated>
<MainNavigator />
</Rehydrated>
</ApolloProvider>
Most helpful comment
I got rid of the error by specified the client as any before assigning to ApolloProvider
<ApolloProvider client={client as any}>But why the types are incompatible?