Aws-mobile-appsync-sdk-js: Type 'AWSAppSyncClient<{}>' is not assignable to type 'ApolloClient<{}>'

Created on 30 Jun 2018  路  6Comments  路  Source: awslabs/aws-mobile-appsync-sdk-js

I have 'apollo-boost' installed. typescript generated this error:

Type 'AWSAppSyncClient<{}>' is not assignable to type 'ApolloClient<{}>'

Angular

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?

All 6 comments

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.

@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>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ArronHsiao picture ArronHsiao  路  3Comments

peterservisbot picture peterservisbot  路  3Comments

JonathanHolvey picture JonathanHolvey  路  4Comments

yarax picture yarax  路  3Comments

schickling picture schickling  路  3Comments