Skip to content

Commit c0b9db7

Browse files
authored
chore(Worklets): merge isSynchronizable impl (#9027)
## Summary After giving it some thought I decided that it makes no sense to provide a throwing implementation for `isSynchronizable` on web if `createSynchronizable` already throws. A bit of DRY to the codebase. ## Test plan 🚀
1 parent cc67ee7 commit c0b9db7

2 files changed

Lines changed: 8 additions & 19 deletions

File tree

packages/react-native-worklets/src/memory/isSynchronizable.native.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
'use strict';
22

3-
import { WorkletsError } from '../debug/WorkletsError';
43
import type { Synchronizable } from './types';
54

65
export function isSynchronizable<TValue>(
7-
_value: unknown
8-
): _value is Synchronizable<TValue> {
9-
throw new WorkletsError('`isSynchronizable` is not supported on web.');
6+
value: unknown
7+
): value is Synchronizable<TValue> {
8+
'worklet';
9+
return (
10+
typeof value === 'object' &&
11+
value !== null &&
12+
!!(value as Record<string, unknown>).__synchronizableRef
13+
);
1014
}

0 commit comments

Comments
 (0)