mayteio / use-pusher

👉 Easy as react/native hooks that integrate with the pusher-js library
https://use-pusher-docs.netlify.com/
144 stars 33 forks source link

dts-bundle-generator automatically pulls in react-native type reference for web build #16

Closed jamesreggio closed 3 years ago

jamesreggio commented 4 years ago

We're using this package in a web product, and we're encountering issues during compilation because the type definitions reference the react-native types, which we haven't installed in our product.

Could you consider vendoring (copying in) the types you need from React Native so we're able to use this package from web products?

For reference, this is the error from the TypeScript compiler:

Screen Shot 2020-07-28 at 17 11 29

mayteio commented 4 years ago

Sure thing, apologies for that unexpected side effect. Are you able to find a work around for the bug in the meantime?

Would love to see how it's being used too!

jamesreggio commented 4 years ago

Thanks for the quick response!

We have to vendor a copy of the library and remove the line — it's not pretty, but it works for now.

We're using it for an internal trailer management tool at Convoy. Can't show you the tool, unfortunately.

mayteio commented 4 years ago

Hey @jamesreggio I have moved that definition into @harelpls/use-pusher/react-native/index.d.ts with 6.0.3. Can you please check and let me know if that works for you?

mayteio commented 4 years ago

Got to the bottom of this - dts-bundle-generator (which builds our .d.ts files) is pulling in react-native reference automatically. The bandaid solution is to just delete it before releasing to npm. Need to fix this automatically.

mayteio commented 4 years ago

7.0.0* Did some major house work and upgraded deps (breaking). This package now uses pusher-js@7.0.0

cowsrule commented 3 years ago

I can confirm this is solved. However there are straggling issues due to deps which are solved in https://github.com/mayteio/use-pusher/pull/46.

mayteio commented 3 years ago

Nice! Fixed with 7.2.1.