Skip to content
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

Type annotations are not supported in __workletClass #6642

Open
wcandillon opened this issue Oct 28, 2024 · 3 comments · May be fixed by #6667
Open

Type annotations are not supported in __workletClass #6642

wcandillon opened this issue Oct 28, 2024 · 3 comments · May be fixed by #6667
Assignees
Labels
Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS

Comments

@wcandillon
Copy link
Contributor

wcandillon commented Oct 28, 2024

Description

A class that has the __workletClass annotation doesn't support any kind of type annotations.
The following works:

class Test {
  __workletClass = true;
  value;

  constructor(value) {
    this.value = value;
  }
}

But the following wouldn't:

class Test {
  __workletClass = true;
  value: number;

  constructor(value: number) {
    this.value = value;
  }
}

or

class Test<T> {
  __workletClass = true;
  value: T;

  constructor(value: T) {
    this.value = value;
  }
}

Steps to reproduce

Add a type annotation to a class that has the __workletClass property. Adding a type annotations to https://github.com/software-mansion/react-native-reanimated/blob/main/apps/common-app/src/examples/RuntimeTests/tests/plugin/fileWorkletization.ts should be enough to reproduce the issue.

Snack or a link to a repository

https://github.com/shopify/react-native-skia

Reanimated version

3.5.1

React Native version

0.75.2

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS Missing repro This issue need minimum repro scenario labels Oct 28, 2024
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@tomekzaw
Copy link
Member

cc @tjzel Can you please take a look?

@wcandillon
Copy link
Contributor Author

@tjzel tjzel self-assigned this Oct 29, 2024
@tjzel tjzel linked a pull request Nov 5, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants