Skip to content

Support for ts-pattern.match() inside worklets #244

@salemkode

Description

@salemkode

🧠 Feature Request: Support for ts-pattern.match() inside Reanimated worklets

I'm requesting support for using ts-pattern's match() function inside worklets

🧪 Current Behavior

Using ts-pattern.match inside a worklet results in the following runtime

ts-pattern.match() causes [Reanimated] Tried to synchronously call a non-worklet function on the UI thread

💡 Why This Matters

  • ts-pattern enables exhaustive, type-safe pattern matching in TypeScript.

  • Many developers reach for this library to improve control flow and readability, including in animations or shared UI logic.

  • However, worklet context throws errors because match() creates closures and uses non-serializable logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions