Creates an IndexRecordTypeGuard that checks that the value is an index record with the specified value type.
IndexRecordTypeGuard
Can be shortened with TypeGuard.indexRecord.
TypeGuard.indexRecord
The value type for all keys
The type guard for the values
A type guard for Record<PropertyKey, T>
Record<PropertyKey, T>
const isNumberRecord = isIndexRecord(isNumber); // or isNumber.indexRecord()// ^? TypeGuard<Record<PropertyKey, number>>isNumberRecord({ a: 1, b: 2 }); // trueisNumberRecord({ a: 1, b: "2" }); // false Copy
const isNumberRecord = isIndexRecord(isNumber); // or isNumber.indexRecord()// ^? TypeGuard<Record<PropertyKey, number>>isNumberRecord({ a: 1, b: 2 }); // trueisNumberRecord({ a: 1, b: "2" }); // false
Creates an
IndexRecordTypeGuardthat checks that the value is an index record with the specified value type.Can be shortened with
TypeGuard.indexRecord.