Function: hasProperties()
function hasProperties<K>(
value: unknown,
properties: readonly K[]
): value is Record<K, unknown> & UnknownRecord;
Defined in: shared/utils/typeGuards.ts:63
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> & UnknownRecord
true when the value is an object containing every property.
Remarksโ
Uses objectHasOwn from ts-extras to avoid prototype traversal and preserve
own-property narrowing.
Exampleโ
if (hasProperties(obj, ["foo", "bar"])) {
// obj has both 'foo' and 'bar'
}