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

Support for disabling decorator syntax #18

Closed
unadlib opened this issue Aug 14, 2020 · 1 comment
Closed

Support for disabling decorator syntax #18

unadlib opened this issue Aug 14, 2020 · 1 comment
Labels
discussion Discussion of some controversial issues

Comments

@unadlib
Copy link
Owner

unadlib commented Aug 14, 2020

Relevant Package

  • reactant-module
  • reactant-di

Description

Many developers still have concerns about TS and JS decorators. In particular, the decorator is a feature of the language that is not stable over the long term, so support for disabling the decorator in reactant-module and reactant-di is open to discussion.

For example,

@injectable()
class Foo {
  @state
  foo = '';

  @action
  update(text: string) {
    this.foo = text;
  }
}

When disabling the decorator, it's equal to:

decorate(
  class Foo {
    constructor() {
       this.foo = '';
       decorate(this, {
         foo: state,
         update: action,
       });
    }

    update(text: string) {
      this.foo = text;
    }
  },
  injectable
)
@unadlib unadlib added the discussion Discussion of some controversial issues label Aug 14, 2020
@unadlib
Copy link
Owner Author

unadlib commented Feb 20, 2022

deprecated

@unadlib unadlib closed this as completed Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussion of some controversial issues
Projects
None yet
Development

No branches or pull requests

1 participant