Array of keys for the record
The value type for all keys
A type guard for Partial<Record<K, V>>
const timeUnits = ["second", "minute", "hour"] as const;
const isPartialTimeRecord = isPartialRecord(timeUnits, isNumber);
// ^? TypeGuard<Partial<Record<"second" | "minute" | "hour", number>>>
isPartialTimeRecord({ second: 1 }); // true
isPartialTimeRecord({}); // true
isPartialTimeRecord({ second: "1" }); // false (wrong value type)
Creates a
PartialRecordTypeGuardthat checks that the value is a partial record with the specified keys and value type.