Skip to main content

Function: safePropertyAccess()

safePropertyAccess(obj: unknown, key: string): unknown

Defined in: shared/utils/typeHelpers.ts:83

Safely extracts a property from an unknown object.

Parametersโ€‹

objโ€‹

unknown

Unknown object to extract from

keyโ€‹

string

Property key to extract

Returnsโ€‹

unknown

Property value or undefined

Remarksโ€‹

Provides safe property access from unknown objects without type assertions. Returns undefined if object is not an object or property doesn't exist.