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 311 forks source link

Generic type 'QueryOptions<TVariables>' requires between 0 and 1 type arguments. After upgrading from v1.10 to 2.6 #1689

Closed eviazmensky-andela closed 2 years ago

eviazmensky-andela commented 3 years ago

Describe the bug

When upgrading from apollo-angular 1.10 to 2.6, the following typescript errors are being generated during the build:

Error: node_modules/apollo-angular/apollo.d.ts:14:40 - error TS2707: Generic type 'QueryOptions<TVariables>' requires between 0 and 1 type arguments.

14     query<T, V = EmptyObject>(options: QueryOptions<V, T>): Observable<ApolloQueryResult<T>>;
                                          ~~~~~~~~~~~~~~~~~~

Error: node_modules/apollo-angular/apollo.d.ts:16:44 - error TS2707: Generic type 'SubscriptionOptions<TVariables>' requires between 0 and 1 type arguments.

16     subscribe<T, V = EmptyObject>(options: SubscriptionOptions<V, T>, extra?: ExtraSubscriptionOptions): Observable<FetchResult<T>>;
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/apollo-angular/types.d.ts:13:111 - error TS2344: Type '"query" | "variables"' does not satisfy the constraint '"useInitialLoading"'.
  Type '"query"' is not assignable to type '"useInitialLoading"'.

13 export interface WatchQueryOptionsAlone<TVariables, TData> extends Omit<WatchQueryOptions<TVariables, TData>, 'query' | 'variables'> {
                                                                                                                 ~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/apollo-angular/types.d.ts:15:68 - error0m TS2707: Generic type 'QueryOptions<TVariables>' requires between 0 and 1 type arguments.

15 export interface QueryOptionsAlone<TVariables, TData> extends Omit<CoreQueryOptions<TVariables, TData>, 'query' | 'variables'> {
                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/apollo-angular/types.d.ts:19:75 - error TS2707: Generic type 'SubscriptionOptions<TVariables>' requires between 0 and 1 type arguments.

19 export interface SubscriptionOptionsAlone<TVariables, TData> extends Omit<CoreSubscriptionOptions<TVariables, TData>, 'query' | 'variables'> {
                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/apollo-angular/types.d.ts:21:63 - error TS2707: Generic type 'WatchQueryOptions<TVariables>' requires between 0 and 1 type arguments.

21 export interface WatchQueryOptions<TVariables, TData> extends CoreWatchQueryOptions<TVariables, TData> {
                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is happening with ng upgrade, ng add, yarn update, and yarn add

To Reproduce Steps to reproduce the behavior: Starting with an angular 11 application using apollo-angular 1.10, attempt to upgrade to apollo-angular 2.6. Start the application using ng serve

Expected behavior

The application should start after the upgrade.

Environment:

- @angular/cli@11.1.2
- @angular/core@11.2.7
- @apollo/client@3.0.0
- apollo-angular@2.6.0
- graphql@15.0.0
- typescript@4.1.3

Additional context

Screen Shot 2021-06-15 at 7 38 47 AM

kamilkisiela commented 2 years ago

Look at packages/demo, it works fine.