Changeset View
Changeset View
Standalone View
Standalone View
lib/shared/messages/message-spec.js
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | +notificationTexts?: ( | ||||
messageInfos: $ReadOnlyArray<MessageInfo>, | messageInfos: $ReadOnlyArray<MessageInfo>, | ||||
threadInfo: ThreadInfo, | threadInfo: ThreadInfo, | ||||
params: NotificationTextsParams, | params: NotificationTextsParams, | ||||
) => Promise<?NotifTexts>, | ) => Promise<?NotifTexts>, | ||||
+notificationCollapseKey?: ( | +notificationCollapseKey?: ( | ||||
rawMessageInfo: RawInfo, | rawMessageInfo: RawInfo, | ||||
messageData: Data, | messageData: Data, | ||||
) => ?string, | ) => ?string, | ||||
+generatesNotifs: ( | +generatesNotifs?: ( | ||||
rawMessageInfo: RawInfo, | rawMessageInfo: RawInfo, | ||||
messageData: Data, | messageData: Data, | ||||
params: GeneratesNotifsParams, | params: GeneratesNotifsParams, | ||||
) => Promise<?PushType>, | ) => Promise<?PushType>, | ||||
ashoat: Should this have been modified to return `PushType`? It looks like all of the cases where we… | |||||
marcinAuthorUnsubmitted Done Inline ActionsChanging to PushType results in flow error. We removed all cases when generatesNotifs method invariantly returned undefined. Other generatesNotifs methods might return undefined in some cases depending on the particular notification content. For example: Cannot assign Object.freeze(...) to reactionMessageSpec because undefined [1] is incompatible with literal union [2] in type argument R [3] of the return value of property generatesNotifs. [incompatible-type-arg] shared/messages/reaction-message-spec.js 213│ ); 214│ 215│ if (targetMessageInfo?.creatorID !== notifTargetUserID) { [1] 216│ return undefined; 217│ } 218│ return action === 'add_reaction' ? pushTypes.NOTIF : pushTypes.RESCIND; 219│ }, /private/tmp/flow/flowlib_2fd0d9f42c28b9ff_501/core.js [3] 1809│ declare class Promise<+R> { shared/messages/message-spec.js [2] 113│ ) => Promise<PushType>, marcin: Changing to `PushType` results in flow error. We removed all cases when `generatesNotifs`… | |||||
ashoatUnsubmitted Not Done Inline ActionsThanks for explaining! ashoat: Thanks for explaining! | |||||
+userIDs?: (rawMessageInfo: RawInfo) => $ReadOnlyArray<string>, | +userIDs?: (rawMessageInfo: RawInfo) => $ReadOnlyArray<string>, | ||||
+startsThread?: boolean, | +startsThread?: boolean, | ||||
+threadIDs?: (rawMessageInfo: RawInfo) => $ReadOnlyArray<string>, | +threadIDs?: (rawMessageInfo: RawInfo) => $ReadOnlyArray<string>, | ||||
+includedInRepliesCount?: boolean, | +includedInRepliesCount?: boolean, | ||||
+useCreationSideEffectsFunc?: () => CreationSideEffectsFunc<RawInfo>, | +useCreationSideEffectsFunc?: () => CreationSideEffectsFunc<RawInfo>, | ||||
+validator: TType<RawInfo>, | +validator: TType<RawInfo>, | ||||
}; | }; |
Should this have been modified to return PushType? It looks like all of the cases where we return undefined have been removed, but I may be missing something