mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
ts: Convert stream_settings_containers.js to TypeScript.
Added assertion to enforce `sub` is not `undefined` and thus type safe for the rest. Added type annotation to function parameter and return value.
This commit is contained in:
@@ -194,7 +194,7 @@ EXEMPT_FILES = make_set(
|
||||
"web/src/stream_list.js",
|
||||
"web/src/stream_muting.js",
|
||||
"web/src/stream_popover.js",
|
||||
"web/src/stream_settings_containers.js",
|
||||
"web/src/stream_settings_containers.ts",
|
||||
"web/src/stream_settings_ui.js",
|
||||
"web/src/stream_ui_updates.js",
|
||||
"web/src/submessage.js",
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import $ from "jquery";
|
||||
|
||||
export function get_edit_container(sub) {
|
||||
return $(
|
||||
`#subscription_overlay .subscription_settings[data-stream-id='${CSS.escape(
|
||||
sub.stream_id,
|
||||
)}']`,
|
||||
);
|
||||
}
|
||||
13
web/src/stream_settings_containers.ts
Normal file
13
web/src/stream_settings_containers.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import $ from "jquery";
|
||||
import assert from "minimalistic-assert";
|
||||
|
||||
import type {StreamSubscription} from "./sub_store";
|
||||
|
||||
export function get_edit_container(sub: StreamSubscription): JQuery {
|
||||
assert(sub !== undefined, "Stream subscription is undefined.");
|
||||
return $(
|
||||
`#subscription_overlay .subscription_settings[data-stream-id='${CSS.escape(
|
||||
sub.stream_id.toString(),
|
||||
)}']`,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user