invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

Object literal may only specify known properties, and 'inAppNotificationSettings' does not exist in type 'IOSNotificationPermissions' #1029

Closed HardikGaur closed 5 months ago

HardikGaur commented 7 months ago

I am using notifee in my react native application. I am trying to use the method

notifee.requestPermission({
inAppNotificationSettings:true
})

This is giving me a typescript error

Object literal may only specify known properties, and 'inAppNotificationSettings' does not exist in type 'IOSNotificationPermissions'

In the documentation Permission Settings it is mentioned we can use this property, but in the typescript definition of the object that this function takes, the above property is missing. The typescript definition of requestpermission is as given below

requestPermission(permissions?: IOSNotificationPermissions): Promise<NotificationSettings>;

And the IOSNotificationPermissions is defined as

export interface IOSNotificationPermissions {

    alert?: boolean;

    criticalAlert?: boolean;

    badge?: boolean;

    sound?: boolean;

    carPlay?: boolean;

    provisional?: boolean;

    announcement?: boolean;
}

As we can see the above type definition does not have anything for inAppNotificationSettings. This variable is defined in another type definition which also contains other properties that we can pass to requestPermission().

export interface IOSNotificationSettings {

    alert: IOSNotificationSetting;

    badge: IOSNotificationSetting;

    criticalAlert: IOSNotificationSetting;

    showPreviews: IOSShowPreviewsSetting;

    sound: IOSNotificationSetting;

    carPlay: IOSNotificationSetting;

    lockScreen: IOSNotificationSetting;

    announcement: IOSNotificationSetting;

    notificationCenter: IOSNotificationSetting;

    inAppNotificationSettings: IOSNotificationSetting;

    authorizationStatus: AuthorizationStatus;
}

I believe that the type definition of the object that requestPermission() accepts should be IOSNotificationSettings instead of IOSNotificationPermissions

github-actions[bot] commented 6 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.