OneSignal / react-onesignal

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

[Bug]: Property X does not exist on type  Function #120

Closed KDederichs closed 10 months ago

KDederichs commented 10 months ago

What happened?

I get an does not exist on type  Function Typescript error in IntelliJ for a LOT of v3 Functions. This includes (but may not be limited to):

OneSignal.Notifications.permission // TS2339: Property  permission  does not exist on type  Function
OneSignal.Notifications.removeEventListener // TS2339: Property  removeEventListener  does not exist on type  Function
OneSignal.Notifications.addEventListener // TS2339: Property addEventListener  does not exist on type  Function
OneSignal.User.addTag  // TS2339: Property addTag  does not exist on type  Function

What browsers are you seeing the problem on?

Firefox, Chrome (Chromium), Safari

What operating system are you running?

13.4

Steps to reproduce?

Install OneSignal 3.0 in a Typescript enabled project and use the functions

What did you expect to happen?

Correct typings

Relevant log output

No response

jkasten2 commented 10 months ago

@KDederichs Thanks for reaching out!

I attempt to reproduce the issue with a new react project and was not able to find a typescript or runtime issue with any of the functions you listed.

Are you seeing a compiler error? Or is the error you are seeing limited to IntelliJ?

Can you provide more details on how you are importing OneSignal as well?

KDederichs commented 10 months ago

Looks like it's an IntelliJ/TS thing that goes away when you restart the TS service.