Skip to content

Incorrect TS type for authorizationStatus in PushNotificationPermissions #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cmrigney opened this issue Oct 16, 2020 · 2 comments
Closed

Comments

@cmrigney
Copy link

The type returned by PushNotificationIOS.requestPermissions(...) is PushNotificationPermissions which has a property authorizationStatus. The real type of the authorizationStatus property is a number but the TS type has it as an interface.

Currently, I have to do this to bypass the TypeScript error:

const permission = await PushNotificationIOS.requestPermissions(...)
const authorized = ((permission.authorizationStatus as any) as number) === PushNotificationIOS.AuthorizationStatus.UNAuthorizationStatusAuthorized
Mighty683 pushed a commit to Mighty683/push-notification-ios that referenced this issue Oct 19, 2020
Mighty683 added a commit to Mighty683/push-notification-ios that referenced this issue Oct 19, 2020
Naturalclar pushed a commit that referenced this issue Oct 19, 2020
@Naturalclar
Copy link
Collaborator

@cmrigney thanks for raising the issue!
The fix has been applied and published in v1.6.1 🎉

@cmrigney
Copy link
Author

@Naturalclar That was fast, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants