OneSignal / react-onesignal

React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
73 stars 26 forks source link

[Typescript]: Event listeners type signature issue after 2.0.3 release #70

Closed gadishimwe closed 2 years ago

gadishimwe commented 2 years ago

Hello. When 2.0.3 was released, the listener functions type signature was changed from Function to () => void. With the new signature, it means that these functions will not receive any arguments. You can see this change here:

https://github.com/OneSignal/react-onesignal/pull/59/files#diff-dcdc3e0b3362edb8fec2a51d3fa51f8fb8af8f70247e06d9887fa934834c9122L107-R126

Now my question is, how are we going to get those values that we were expecting for those events?

For example:

OneSignal.on('subscriptionChange', function(isSubscribed) {
  console.log("The user's subscription state is now:", isSubscribed);
});

This code can't be compiled by typescript. Thanks

rgomezp commented 2 years ago

Howdy, Thanks for opening the issue. This is indeed a problem. Thanks for your patience while we resolve.

gadishimwe commented 2 years ago

Howdy, Thanks for opening the issue. This is indeed a problem. Thanks for your patience while we resolve.

Howdy. You're welcome!

rgomezp commented 2 years ago

@gadishimwe , this is now fixed in 2.0.4.

Enjoy!