mirror of https://github.com/zulip/zulip.git
vdom: Fix types.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
fcd8395eb5
commit
961c7185ab
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue