Missing Typescript types for zen-observable in non-dev installation
Poky85 opened this issue · 2 comments
Poky85 commented
When using apollo-link-sentry
in Typescript project I get an error due to missing types for zen-observable
.
node_modules/apollo-link-sentry/lib/SentryLink.d.ts:2:24 - error TS7016: Could not find a declaration file for module 'zen-observable'. '/node_modules/zen-observable/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/zen-observable` if it exists or add a new declaration (.d.ts) file containing `declare module 'zen-observable';`
2 import Observable from 'zen-observable';
~~~~~~~~~~~~~~~~
This is because @types/zen-observable
is dev dependency of apollo-link-sentry
so it doesn't get installed on npm install apollo-link-sentry
.
I suggest using zen-observable-ts
which is a thin wrapper adding types. Then instead of
"dependencies": {
"zen-observable": "^0.8.15"
},
and
import Observable from 'zen-observable-ts';
we would use
"dependencies": {
"zen-observable-ts": "^1.1.0"
},
and
import { Observable } from 'zen-observable-ts';
spawnia commented
Thanks for the report, fixed with https://github.com/DiederikvandenB/apollo-link-sentry/releases/tag/v3.2.2.
Poky85 commented
That was pretty fast! Thank you! ❤️