Function: hasProperty()
hasProperty<
K
>(value
:unknown
,property
:K
):value is Record<K, unknown>
Defined in: shared/utils/typeGuards.ts:86
Determines if an object contains a specific property.
Type Parametersโ
Kโ
K
extends PropertyKey
The property key to check for.
Parametersโ
valueโ
unknown
The value to check.
propertyโ
K
The property key that must be present on the value.
Returnsโ
value is Record<K, unknown>
True if value
is an object containing the specified property;
otherwise, false.
Exampleโ
if (hasProperty(obj, "foo")) {
// obj has the 'foo' property
}