OneSignal/react-onesignal

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

gadishimwe opened this issue · 3 comments

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

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

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

Howdy. You're welcome!

@gadishimwe , this is now fixed in 2.0.4.

Enjoy!