Let layoutShallowEquals compare any layout-shaped object

This commit is contained in:
Johannes Marbach
2026-09-28 17:27:04 +02:00
parent 29742006df
commit 10adf6658b
+4 -3
View File
@@ -150,10 +150,11 @@ export type Layout =
| PipLayout;
/**
* Tests whether the top-level properties and array elements of layout `a` are
* equal to those of layout `b`. Useful for deduping redundant layout updates.
* Tests whether the top-level properties and array elements of `a` are equal
* to those of `b`. Useful for deduping redundant layout and layout media
* updates.
*/
export function layoutShallowEquals(a: Layout, b: Layout): boolean {
export function layoutShallowEquals<T extends object>(a: T, b: T): boolean {
// If a and b have the same number of keys and every key in a is also in b,
// then they have the same keys.
const aKeys = Object.keys(a);