OneSignal/react-onesignal

[TypeScript] Inadequate Type Definitions for OneSignal.init parameters

PrinceGupta1999 opened this issue · 1 comments

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

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.