/** * Narrows a union to the member(s) that declare `key` — a type-guard replacement for the * `in` operator's discriminated-union narrowing. Returns `true` only when `key` is an own * property of `obj`. For a plain boolean presence check where no type narrowing is needed, * prefer `Object.hasOwn(obj, key)` directly. * * The 'worklet' directive is required because this function is called from inside * useAnimatedStyle and applyStyleKey — both run on the Reanimated UI thread. */ export function hasKey(key: K, obj: unknown): obj is Record { 'worklet'; return obj !== null && typeof obj === 'object' && Object.hasOwn(obj, key); } export function objectKeys(obj: T): Array { 'worklet'; // biome-ignore lint/plugin: the type system guarantees this is safe return Object.keys(obj) as Array; }