@types/zen-observable missing in dependencies list
See original GitHub issueProblem
This lib is compiled to use @types/zen-observable
as a shadow dependency. This won’t be a problem in node_modules as @apollo/client
-> zen-observable-ts
-> @types/zen-observable
.
But it throws when used with yarn v2 PnP where shadow dependency is strictly forbidden. An example output is:
../../.yarn/__virtual__/@apollo-client-virtual-65fb8a2b1f/0/cache/@apollo-client-npm-3.4.8-69b6059fd9-07e4f32545.zip/node_modules/@apollo/client/link/utils/fromError.d.ts:1:23 - error TS2688: Cannot find type definition file for 'zen-observable'.
/// <reference types="zen-observable" />
There are dozens of such errors. After a quick glance at the code, I found that the source code does not use the shadow dependency at all, it is solely a result of the ts compilation.
Workaround
yarn v2 provides a way to patch the deps of packages:
# .yarnrc.yml
packageExtensions:
"@apollo/client@*":
dependencies:
"@types/zen-observable": "*"
Solution
As simply patching @apollo/client
with a dependency eradicates the errors, the straight forward solution would be fixing the dependencies list.
I have found a relating issue #2405 . It was once fixed but now on master branch the dependencies are removed again.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top GitHub Comments
My project has switched from PnP to node modules for ESM support, so I cannot reproduce the error in the original project.
Having tested
@apollo/client@3.5.0-beta.8
in a fresh new project with PnP enabled, it worked! Thanks a lot for your quick action 😛@onichandame Can you try with
@apollo/client@3.5.0-beta.8
(just published)? When I install that version, I no longer see the commentsso I’m hopeful your issue will be solved.