kamilkisiela / apollo-client-rxjs

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

Typings are wrong for Observable.lift #36

Open armstrjare opened 7 years ago

armstrjare commented 7 years ago

I think this is wrong - has broken stuff for me.

Should be something like...

public lift<R>(operator: Operator<ApolloQueryResult<T>, R>): Observable<R> {

Otherwise map etc doesn't work.

I'm currently getting typescript compile errors because of the type mismatch when i use .map

rxObs.map(result => result.data)  // invalid type, as T is not compatible with ApolloQueryResult<T>

See also:

armstrjare commented 7 years ago

Actually, turns out this line wasn't actually the reason the compile errors were coming through (I hadn't updated other types to remove my ApolloQueryResult wrapping).

But - I think the typings for lift are still wrong, even if it doesn't result in type errors (because the types are not checked since rxjs is compiled to es5?)

kamilkisiela commented 7 years ago

@armstrjare Could you create a reproduction? It could be even in /tests/RxObservableQuery.ts.

kamilkisiela commented 6 years ago

If you use apollo-angular then we changed the way ApolloClient works with RxJS. You can check it here: apollographql/apollo-angular#377

No more this kind of issues.