I am attempting to set a notification priority to HIGH
, as noted in the docs here and specific parameter defined here. However, when I set this property in my cloud function, I get the following error when attempting to deploy:
src/index.ts:107:35 - error TS2345: Argument of type '{ tokens: string[]; notification: { title: string; body: any; }; data: { title: any; subtitle: any; body: any; id: any; }; android: { notification: { icon: string; channel_id: string; tag: any; }; priority: string; }; }' is not assignable to parameter of type 'MulticastMessage'.
The types of 'android.priority' are incompatible between these types.
Type 'string' is not assignable to type '"normal" | "high" | undefined'.
107 admin.messaging().sendMulticast(message)
~~~~~~~
I understand this means I shouldn't be entering a string. But according to the docs, that's the expected type. Not only that, but I'm very confused on what type it's referring to in the quotations marks '"normal | "high" | undefined'
. What is that type?
Here is the full message container being set:
const message = {
tokens: tokens,
notification: {
title: snapshot.data().sender_username + " - " + snapshot.data().group_name,
body: snapshot.data().content
},
data: {
title: snapshot.data().group_name,
subtitle: snapshot.data().sender_username,
body: snapshot.data().content,
id: message_topic
},
android: {
notification: {
icon: 'add_circle_outline',
channel_id: 'exampleChannelId',
tag: message_topic
},
priority: "high" // <-- This is where the error is thrown
}
};