This commit is contained in:
Michael Telatynski 2025-01-28 11:31:38 +00:00
parent e71f9e327e
commit 0e8315493e

View File

@ -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;
}