diff --git a/tools/test-js-with-node b/tools/test-js-with-node index e427ba2907..e2608e289a 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -240,7 +240,7 @@ EXEMPT_FILES = make_set( "web/src/stream_settings_ui.js", "web/src/stream_ui_updates.js", "web/src/submessage.js", - "web/src/subscriber_api.js", + "web/src/subscriber_api.ts", "web/src/timerender.ts", "web/src/tippyjs.ts", "web/src/todo_widget.js", diff --git a/web/src/subscriber_api.js b/web/src/subscriber_api.ts similarity index 74% rename from web/src/subscriber_api.js rename to web/src/subscriber_api.ts index d20793217d..eb7ebce354 100644 --- a/web/src/subscriber_api.js +++ b/web/src/subscriber_api.ts @@ -1,5 +1,6 @@ import * as channel from "./channel"; import * as people from "./people"; +import type {StreamSubscription} from "./sub_store"; /* This module simply encapsulates our legacy API for subscribing @@ -8,7 +9,12 @@ import * as people from "./people"; nor how to JSON.stringify things, nor the URL scheme. */ -export function add_user_ids_to_stream(user_ids, sub, success, failure) { +export function add_user_ids_to_stream( + user_ids: number[], + sub: StreamSubscription, + success: () => void, + failure: (xhr: JQuery.jqXHR) => void, +): JQuery.jqXHR | undefined { // TODO: use stream_id when backend supports it const stream_name = sub.name; if (user_ids.length === 1 && people.is_my_user_id(Number(user_ids[0]))) { @@ -32,7 +38,12 @@ export function add_user_ids_to_stream(user_ids, sub, success, failure) { }); } -export function remove_user_id_from_stream(user_id, sub, success, failure) { +export function remove_user_id_from_stream( + user_id: number[], + sub: StreamSubscription, + success: () => void, + failure: (xhr: JQuery.jqXHR) => void, +): JQuery.jqXHR | undefined { // TODO: use stream_id when backend supports it const stream_name = sub.name; return channel.del({