-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add isWorklet
function
#4894
Add isWorklet
function
#4894
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me looks good hehe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, let's promote isWorklet
function to a worklet and use it in the UI runtime code as well.
Waits to be merged after 3.7.0 release. |
Summary
This PR adds
isWorklet
function which is meant to be used internally as well as by other libraries in order to check whether the input value is a worklet (i.e. is a function with__workletHash
property added by Reanimated Babel plugin).Once worklet types are fixed,
isWorklet
should mark the input value as worklet, i.e. we'll need to change its signature toexport function isWorklet(value: unknown): value is WorkletType
.EDIT from @tjzel:
In order to be able to use the new function
isWorklet
properly I had to fix a bunch of types with regard to worklet types.Test plan
Check that TS CI passes and all the ifs with
.__workletHash
were changed properly.