我将 TS 用于 Firebase Cloud Functions 并在我想部署该函数时收到此 SyntaxError。
这是我的源代码:
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp();
const db = admin.firestore();
const fcm = admin.messaging();
export const sendToTopicNewsAusschuss = functions.firestore
.document('news/{newsId}')
.onCreate(async snapshot => {
const oneNews = snapshot.data();
const payload: admin.messaging.MessagingPayload = {
notification: {
title: 'News',
body: `${oneNews.newsTitle}`,
clickAction: 'FLUTTER_NOTIFICATION_CLICK'
}
};
return fcm.sendToTopic('newsausschuss', payload);
});
希望你能帮到我
谢谢