We found it useful to export the concrete types DecodedNotificationDataPayload and DecodedNotificationSummaryPayload. This allows us to use a type guard function and then utilise these types as input parameters, for instance.
const normalizeAppleV2DataNotification = async (
notification: DecodedNotificationDataPayload, // <- Here, we used the type guard before calling this function, and now we want to directly use the concrete type
): Promise<AppleNormalizedNotificationV2> => {
// If we don't export the concrete types, we have to type the param as "DecodedNotificationPayload" and use the type guard function here again
const transactionInfo = await decodeTransaction(
notification.data.signedTransactionInfo,
);
const renewalInfo = await decodeRenewalInfo(
notification.data.signedRenewalInfo,
);
const startTime = new Date(Number(transactionInfo.purchaseDate));
// The implementation continues from here...
}
Apologies for not considering this in the previous pull request. Thank you once again for your hard work!
Hi August!
We found it useful to export the concrete types
DecodedNotificationDataPayload
andDecodedNotificationSummaryPayload
. This allows us to use a type guard function and then utilise these types as input parameters, for instance.Apologies for not considering this in the previous pull request. Thank you once again for your hard work!