mirror of https://github.com/zulip/zulip.git
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:
parent
54395612c7
commit
1aeab40779
|
@ -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,
|
||||
)}']`,
|
||||
);
|
||||
}
|
|
@ -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(),
|
||||
)}']`,
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue