vdom: Fix types.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-02 15:57:11 -07:00 committed by Tim Abbott
parent fcd8395eb5
commit 961c7185ab
1 changed files with 9 additions and 8 deletions

View File

@ -2,13 +2,10 @@ import _ from "lodash";
import * as blueslip from "./blueslip"; import * as blueslip from "./blueslip";
type Equal<T> = (...args: T[]) => boolean; export type Node = {
key: unknown;
type Node = {
key: number;
render: () => string; render: () => string;
name: string; eq(other: Node): boolean;
eq: Equal<number | Node>;
}; };
type Options = { type Options = {
@ -16,12 +13,16 @@ type Options = {
keyed_nodes: Node[]; keyed_nodes: Node[];
}; };
type Tag = { export type Tag = {
tag_name: string; tag_name: string;
opts: Options; opts: Options;
}; };
export function eq_array<T>(a: T[] | undefined, b: T[] | undefined, eq: Equal<T>): boolean { export function eq_array<T>(
a: T[] | undefined,
b: T[] | undefined,
eq: (a_item: T, b_item: T) => boolean,
): boolean {
if (a === b) { if (a === b) {
// either both are undefined, or they // either both are undefined, or they
// are referentially equal // are referentially equal