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

return action initializer instead of using addInitializer #3818

Closed
wants to merge 1 commit into from

Conversation

phiresky
Copy link
Contributor

Fixes #3817 .

Mobx currently fails to work with spec-compliant decorators (in swc) when using @action x = () => {}.

The reason this issue is hard to see is that apparently both tsc and babel do not follow the decorator spec, while swc does. I've opened an issue with typescript as well microsoft/TypeScript#57096 because both their code as well as the types seem to conflict with the spec.

In any case, this change works both with tsc and with swc (and I assume babel as well).

Copy link

changeset-bot bot commented Jan 19, 2024

⚠️ No Changeset found

Latest commit: c55128f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mweststrate
Copy link
Member

Yeah the spec changed a few times in this regard through the different stages. Things is probably ok, but there is a build failure prevent the tests to run, mind updating? (seems just removing an unused variable which our config is being too sensitive about)

Copy link
Member

@mweststrate mweststrate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storeAnnotation is unused now, failing the build

@phiresky
Copy link
Contributor Author

This was a result of the readme of the spec text being wrong / outdated. I've fixed it in swc here: swc-project/swc#8525 and the spec text has also been fixed, so this is no longer necessary (afaik)

@phiresky phiresky closed this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@action field uses addInitializer from decorator context but that does not exist in the (new) spec
2 participants