OneSignal / react-onesignal

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

[TypeScript] Inadequate Type Definitions for OneSignal.init parameters #124

Open PrinceGupta1999 opened 10 months ago

PrinceGupta1999 commented 10 months ago

Hi!

I was recently integrating this library into my app and found some of the type definitions are very broad for the OneSignal.init function parameters. For ex: IInitObject.welcomeNotification and has a type of object so I had to reference the parameters from the documentation. Similarly notifiyButton, webhooks etc. are also defined as objects.

Defining and exporting these definitions and possibly adding the documentations would make integrations easier and less error prone

DanyPell commented 8 months ago

Yep. Same for promptOptions. Has a type of object so had to do something digging to figure out that we can have actionMessage, acceptButton, and acceptCancel in there. Although, adding promptOptions is buggy because it shows the prompt right upon initing instead of when we trigger a prompt.