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";
type Equal<T> = (...args: T[]) => boolean;
type Node = {
key: number;
export type Node = {
key: unknown;
render: () => string;
name: string;
eq: Equal<number | Node>;
eq(other: Node): boolean;
};
type Options = {
@ -16,12 +13,16 @@ type Options = {
keyed_nodes: Node[];
};
type Tag = {
export type Tag = {
tag_name: string;
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) {
// either both are undefined, or they
// are referentially equal