Apollo-angular: Type Error: Wrong generic types QueryRef (Apollo Client)

Created on 15 Jun 2018  路  7Comments  路  Source: kamilkisiela/apollo-angular

Hello! We're adding Apollo to two projects that use Angular 6 created with the latest Angular CLI. We got the setup done like in the documentation but when we run the project we get these errors:

node_modules/apollo-angular/QueryRef.d.ts(14,33): error TS2314: Generic type 'FetchMoreQueryOptions<TVariables, K>' requires 2 type argument(s).
node_modules/apollo-angular/QueryRef.d.ts(16,60): error TS2314: Generic type 'UpdateQueryOptions<TVariables>' requires 1 type argument(s).

And when we go to compile, the build fails completely. Is there anything we can do here to fix it?

Most helpful comment

Neither one of that upgrades works for us, because we are using Ionic, which depends on RxJs 5, whereas the updates of Apollo Client require RxJs 6.

All 7 comments

skipLibCheck: true in your tsconfig will get around this in the meantime

v1.1.1 contains a fix

This issue came up in latest apollo-client, they changed interfaces a bit...

A little summary because I guess it will make a lot of noise in near future.

[email protected] introduced a breaking change (for typescript users, so for pretty much all of you, angular folks). They changed the way Interfaces behave, now few of them has different generic types which breaks the build.

To support that we released [email protected], that was a rush decision because everyone wanted to have a fix immediately.

  1. If you want to use [email protected]
    you should update to apollo-client 2.3.3 or greater.
  2. If you can't update apollo-client,
    use [email protected].

Neither one of that upgrades works for us, because we are using Ionic, which depends on RxJs 5, whereas the updates of Apollo Client require RxJs 6.

@cbyte ApolloClient introduced that issue so there's nothing I can do about it.

You can still use apollo-client v2.3.2 or less with apollo-angular v1.0.1 or less and it should work. It's also possible to use latest apollo-client with apollo-angular <= 1.0.1, but you have to set skipLibCheck: true in tsconfig's compilerOptions.

You can use Rxjs 6 with Ionic by adding rxjs-compat and doing a bit of tidying

Was this page helpful?
0 / 5 - 0 ratings

Related issues

patriknil90 picture patriknil90  路  7Comments

TobiasKrogh picture TobiasKrogh  路  4Comments

CaerusKaru picture CaerusKaru  路  3Comments

chihab picture chihab  路  4Comments

crumhorn picture crumhorn  路  6Comments