Я пытаюсь установить приоритет уведомления на HIGH
, как указано в документах здесь и указан c параметр, определенный здесь . Однако, когда я устанавливаю это свойство в своей облачной функции, при попытке развертывания я получаю следующую ошибку:
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)
~~~~~~~
Я понимаю, что это означает, что мне не следует вводить строку. Но согласно документам, это ожидаемый тип. Не только это, но я очень смущен тем, к какому типу он относится в кавычках '"normal | "high" | undefined'
. Что это за тип?
Вот полный установленный контейнер сообщений:
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
}
};