mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
This feels a bit more semantically appropriate: it more clearly says "here's some information: there is no (relevant) recipient", rather than "no information available". (Both `null` and `undefined` in JS can have either meaning, but `undefined` especially commonly means the latter.) Concretely, it ensures a bit more explicitness where the value originates: a bare `return;` becomes `return null;`, reflecting the fact that it is returning a quite informative value. Also make the implementation more explicit about what's expected here, replacing truthiness tests with `!== null`. (A bit more idiomatic would be `!= null`, which is equivalent when the value is well-typed and a bit more robust to ill-typing bugs. But lint complains about that version.)
19 lines
348 B
Plaintext
19 lines
348 B
Plaintext
/**
|
|
* @flow strict
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
type RecipientUserIds = number[];
|
|
|
|
type Worker = {|
|
|
get_current_time: () => number, // as ms since epoch
|
|
notify_server_start: RecipientUserIds => void,
|
|
notify_server_stop: RecipientUserIds => void
|
|
|};
|
|
|
|
declare export function update(
|
|
worker: Worker,
|
|
new_recipient: RecipientUserIds | null
|
|
): void;
|