Files
zulip/web/shared/src/typing_status.js.flow
Varun Singh 391e2a8e01 typing_status: Use TypeScript unions for 'Recipient' type.
Typing 'Recipient' as union of 'stream' and 'direct' message type will help with upcoming type inference.
2024-02-07 09:12:49 -08:00

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;