Creates a MapTypeGuard that checks that the value is a Map and all its keys and values are of the correct type.
MapTypeGuard
Map
The type of keys in the map
The type of values in the map
The type guard for map keys
The type guard for map values
A type guard for Map<K, V>
Map<K, V>
const isStringToNumberMap = isMap(isString, isNumber);isStringToNumberMap(new Map([["a", 1], ["b", 2]])); // trueisStringToNumberMap(new Map([[1, "a"]])); // false Copy
const isStringToNumberMap = isMap(isString, isNumber);isStringToNumberMap(new Map([["a", 1], ["b", 2]])); // trueisStringToNumberMap(new Map([[1, "a"]])); // false
Creates a
MapTypeGuardthat checks that the value is aMapand all its keys and values are of the correct type.