mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-04 19:56:45 +02:00
Iterate
This commit is contained in:
parent
e71f9e327e
commit
0e8315493e
@ -40,7 +40,7 @@ type Type = "function" | "string" | "number" | "boolean" | "object";
|
||||
export function isInterface<T>(obj: unknown, keys: Record<keyof T, Type>): obj is T {
|
||||
if (obj === null || typeof obj !== "object") return false;
|
||||
for (const key in keys) {
|
||||
if (typeof obj[key] !== keys[key]) return false;
|
||||
if (typeof (obj as Record<keyof T, unknown>)[key] !== keys[key]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user