diff --git a/mobile/src/test-support/rpc-recording/native-module-traps.ts b/mobile/src/test-support/rpc-recording/native-module-traps.ts index da9ae89977d..3dd3c0390c3 100644 --- a/mobile/src/test-support/rpc-recording/native-module-traps.ts +++ b/mobile/src/test-support/rpc-recording/native-module-traps.ts @@ -24,10 +24,14 @@ export function partialNativeModule(module: string, members: Record): unknown { return new Proxy(members, { get: (target, key) => { - if (typeof key === 'string' && key !== '__esModule' && !(key in target)) { - throw new Error(`Unsubstituted native member: ${module}.${key}`) + if (typeof key === 'string') { + if (key !== '__esModule' && !(key in target)) { + throw new Error(`Unsubstituted native member: ${module}.${key}`) + } + return target[key] } - return Reflect.get(target, key) + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: a symbol key cannot index the declared string record; the trap reads whatever the member object holds there. + return (target as Record)[key] } }) } @@ -45,7 +49,7 @@ export function nativeStoreModule(module: string, declared: Record { void args