Function: hasProperties()
hasProperties<
K>(value:unknown,properties: readonlyK[]):value is Record<K, unknown>
Defined in: shared/utils/typeGuards.ts:54
Verifies that a value exposes a set of own properties.
Type Parametersโ
Kโ
K extends PropertyKey
Property keys that must exist on the value.
Parametersโ
valueโ
unknown
Value to evaluate as an object.
propertiesโ
readonly K[]
Property names that must be present on the value.
Returnsโ
value is Record<K, unknown>
true when the value is an object containing every property.
Remarksโ
Uses ObjectConstructor.hasOwn to avoid prototype traversal.
Exampleโ
if (hasProperties(obj, ["foo", "bar"])) {
    // obj has both 'foo' and 'bar'
}