kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 309 forks source link

Incorrect @apollo/client package dependency #1811

Closed mpo-dev closed 1 year ago

mpo-dev commented 2 years ago

Describe the bug

Using the library apollo-client@4.0.1 causes the following build error when using a @apollo/client package version below v3.4.0, despite the apollo-client library requiring the "@apollo/client": "^3.0.0".

node_modules/apollo-angular/query-ref.d.ts:19:65 - error TS2344: Type 'T' does not satisfy the constraint 'keyof K'.
19     fetchMore<K = V>(fetchMoreOptions: FetchMoreQueryOptions<K, T>): Promise<ApolloQueryResult<T>>;

To Reproduce

Try to build a project with package versions as in my environment.

Expected behavior

The project to build correcty.

Environment:

- @angular/cli@14.0.4
- @angular/core@14.0.4
- @apollo/client@3.3.21
- apollo-angular@4.0.1
- graphql@15.8.0
- typescript@4.7.4
Destreyf commented 2 years ago

@mpo-dev I am using apollo-angular@4.0.1 and able to build successfully, my versions are as follows:

├── @angular/cli@14.2.1
├── @angular/common@14.2.0
├── @angular/core@14.2.0
├── @apollo/client@3.6.9
├── apollo-angular@4.0.1
├── graphql@16.6.0
├── typescript@4.7.4

I would maybe try upgrading your @apollo/client to the latest version 3.6.9 and trying again.

mpo-dev commented 2 years ago

@Destreyf That's the point, I figured apollo-angular@4.0.1 needs at least "@apollo/client": "^3.4.0" by trail and error, despite the library dependency specifying "@apollo/client": "^3.0.0". Any @apollo/client version below 3.4.0 results in build errors.

pawelpiotrowski commented 1 year ago

I can observe similar (same?) error when using apollo-angular 4.2.0 with @apollo/client 3.7.6. Note: it works fine with 3.7.5.

typescript 4.8.4

Working:

"@angular/core": "^15.1.2", ... "@apollo/client": "^3.7.5", "apollo-angular": "^4.2.0",

Not Working:

"@angular/core": "^15.1.2", ... "@apollo/client": "^3.7.6", "apollo-angular": "^4.2.0",

Error:

Screenshot 2023-02-01 at 10 51 36
pawelpiotrowski commented 1 year ago

👆 Seems to be tracked here: https://github.com/kamilkisiela/apollo-angular/pull/1906

ArtistaDu commented 1 year ago

I'm getting the same error... how can I update the apollo client using npm?

etsraphael commented 1 year ago

Same issue here

PowerKiKi commented 1 year ago

Should be solved by #1910, released as 4.2.1.

PowerKiKi commented 1 year ago

Should be solved by #1910, released as 4.2.1.