mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
Typing 'Recipient' as union of 'stream' and 'direct' message type will help with upcoming type inference.
27 lines
636 B
Plaintext
27 lines
636 B
Plaintext
/**
|
|
* @flow strict
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
type DirectMessageObject<UserId: number> = {|
|
|
message_type: string,
|
|
ids: $ReadOnlyArray<UserId>,
|
|
|};
|
|
type StreamObject = {|
|
|
message_type: string,
|
|
stream_id: number,
|
|
topic: string,
|
|
|};
|
|
|
|
type Worker<UserId> = {|
|
|
get_current_time: () => number, // as ms since epoch
|
|
notify_server_start: (DirectMessageObject<UserId> | StreamObject) => void,
|
|
notify_server_stop: (DirectMessageObject<UserId> | StreamObject) => void,
|
|
|};
|
|
|
|
declare export function update<UserId>(
|
|
worker: Worker<UserId>,
|
|
new_recipient: DirectMessageObject<UserId> | StreamObject | null,
|
|
): void;
|