Mike-Gibson / mock-apollo-client

Helps unit test components which use the Apollo Client.
MIT License
117 stars 15 forks source link

Cannot find type definition file for ‘zen-observable' #47

Closed katyaterletskaya closed 2 years ago

katyaterletskaya commented 2 years ago

Description

I'm getting these errors when building the package.

node_modules/mock-apollo-client/dist/mockSubscription.d.ts:1:23 - error TS2688: Cannot find type definition file for 'zen-observable'.

1 /// <reference types="zen-observable" />
                        ~~~~~~~~~~~~~~

node_modules/mock-apollo-client/dist/mockSubscription.d.ts:17:25 - error TS2503: Cannot find namespace 'ZenObservable'.

17     subscribe(observer: ZenObservable.SubscriptionObserver<FetchResult>): void;

Environment

@apollo/client: "^3.6.6" mock-apollo-client: "^1.2.0"

Investigation

ZenObservable.Subscription has been replaced with ObservableSubscription in @apollo/client: 3.5.0 (https://github.com/apollographql/apollo-client/pull/8695)

Mike-Gibson commented 2 years ago

Hi,

Thanks for bringing this to my attention, and sorry for the delayed reply.

This is interesting, as the plan was for mock-apollo-client v1 to work with all 3.x versions of Apollo client. Especially here where it looks like it's just a TypeScript type issue - it would be a shame if we had to have a new, non-backwards compatible version of mock-apollo-client for this.

I will try and take a look at it this week, and see if there's a way it can be backwards compatible. If not, I'll have to have a think what that would mean version-wise going forwards. I'm very open to help/suggestions if you have any!

Thanks.

Mike-Gibson commented 2 years ago

@katyaterletskaya I've just published version 1.2.1 of mock-apollo-client to npm, which hopefully fixes this issue.

Would appreciate if you could let me know whether it fixes the issue for you.

Thanks.

katyaterletskaya commented 2 years ago

Hi @Mike-Gibson, yes, it works. Thank you for the fix 😊