mirror of https://github.com/zulip/zulip.git
vdom: Eliminate undefined type declaration for impossible case.
This was just debugging logic working around the fact that vdom.ts was not originally implemented in TypeScript, and should not be polluting our types.
This commit is contained in:
parent
aab25fae6a
commit
2598596ad2
|
@ -63,8 +63,8 @@ export function _build_direct_messages_list(): vdom.Tag<PMNode> {
|
|||
function set_dom_to(new_dom: vdom.Tag<PMNode>): void {
|
||||
const $container = scroll_util.get_content_element($("#direct-messages-list"));
|
||||
|
||||
function replace_content(html: string | undefined): void {
|
||||
$container.html(html!);
|
||||
function replace_content(html: string): void {
|
||||
$container.html(html);
|
||||
}
|
||||
|
||||
function find(): JQuery {
|
||||
|
|
|
@ -206,8 +206,7 @@ export class TopicListWidget {
|
|||
build(spinner = false): void {
|
||||
const new_dom = this.build_list(spinner);
|
||||
|
||||
const replace_content = (html?: string): void => {
|
||||
assert(html !== undefined);
|
||||
const replace_content = (html: string): void => {
|
||||
this.remove();
|
||||
this.$parent_elem.append(html);
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ export function ul<T>(opts: Options<T>): Tag<T> {
|
|||
};
|
||||
}
|
||||
|
||||
export function render_tag<T>(tag: Tag<T>): string | undefined {
|
||||
export function render_tag<T>(tag: Tag<T>): string {
|
||||
/*
|
||||
This renders a tag into a string. It will
|
||||
automatically escape attributes, but it's your
|
||||
|
@ -66,11 +66,6 @@ export function render_tag<T>(tag: Tag<T>): string | undefined {
|
|||
const start_tag = "<" + tag_name + attr_str + ">";
|
||||
const end_tag = "</" + tag_name + ">";
|
||||
|
||||
if (opts.keyed_nodes === undefined) {
|
||||
blueslip.error("We need keyed_nodes to render innards.");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const innards = opts.keyed_nodes.map((node) => node.render()).join("\n");
|
||||
return start_tag + "\n" + innards + "\n" + end_tag;
|
||||
}
|
||||
|
@ -97,7 +92,7 @@ export function update_attrs(
|
|||
}
|
||||
|
||||
export function update<T>(
|
||||
replace_content: (html: string | undefined) => void,
|
||||
replace_content: (html: string) => void,
|
||||
find: () => JQuery,
|
||||
new_dom: Tag<T>,
|
||||
old_dom: Tag<T> | undefined,
|
||||
|
|
|
@ -249,7 +249,4 @@ run_test("error checking", () => {
|
|||
const ul = {opts: {attrs: []}};
|
||||
|
||||
vdom.update(replace_content, find, ul, ul);
|
||||
|
||||
blueslip.expect("error", "We need keyed_nodes to render innards.");
|
||||
vdom.render_tag(ul);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue