Files
zulip/static/shared/js/typing_status.js.flow
Greg Price 71596648c2 typing_status: Switch sentinel "recipient" value to null.
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.)
2019-10-24 14:56:56 -07:00

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;