kamilkisiela / apollo-client-rxjs

Adds RxJS to ApolloClient
http://apollostack.com
44 stars 12 forks source link

RxObservableQuery.d.ts's lift isn't compatible with Observable's lift defintion [duplicate] #49

Closed kesemdavid closed 6 years ago

kesemdavid commented 6 years ago

I've just npm installed my project and am getting this : ERROR in D:/SOME_PATH/node_modules/apollo-client-rxjs/build/src/RxObservableQuery.d.ts (7,22): Class 'RxObservableQuery<T>' incorrectly extends base class 'Observable<ApolloQueryResult<T>>'. Types of property 'lift' are incompatible. Type '<R>(operator: Operator<ApolloQueryResult<T>, ApolloQueryResult<R>>) => Observable<ApolloQueryResu...' is not assignable to type '<R>(operator: Operator<ApolloQueryResult<T>, R>) => Observable<R>'. Types of parameters 'operator' and 'operator' are incompatible. Type 'Operator<ApolloQueryResult<T>, R>' is not assignable to type 'Operator<ApolloQueryResult<T>, ApolloQueryResult<{}>>'. Type 'R' is not assignable to type 'ApolloQueryResult<{}>'.

Having a quick look i figured the correct definition of RxObservableQuery.lift would be: lift<ApolloQueryResult<R>>(operator: Operator<ApolloQueryResult<T>, ApolloQueryResult<R>>): Observable<ApolloQueryResult<R>>

But that wont compile either..

I've been able to solve this by monkeypatching the .d.ts from: lift<R>(operator: Operator<ApolloQueryResult<T>, ApolloQueryResult<R>>): Observable<ApolloQueryResult<R>>;

to: lift<R>(operator: Operator<ApolloQueryResult<T>, R>): Observable<R>;

@kamilkisiela Please let me know if you encounter the same error and what's the real way of solving it, thanks in advance!