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 ES Decorators #861

Open
1 of 7 tasks
hasezoey opened this issue Jul 3, 2023 · 1 comment
Open
1 of 7 tasks

Support ES Decorators #861

hasezoey opened this issue Jul 3, 2023 · 1 comment
Labels
feature Adds a new Feature or Request

Comments

@hasezoey
Copy link
Member

hasezoey commented Jul 3, 2023

Describe what you need | want

Typescript 5.0 has added support for ES Decorators and Typescript 5.2 has added support for ES Decorator metadata

Do you have already an idea for the implementation?

yes, see branch feature/try-new-decorators

full implementation currently blocked by:

  • Decorator return type has to be any or would have to provide 2 decorators, one each returning PropertyDecorator/ClassDecorator(old decorator type) and ESClassFieldDecorator/ESClassDecorator(new decorator type, manual); otherwise typescript errors with Unable to resolve signature of property decorator when called as an expression. for property decorators, see @prop as a example
  • Property decorators do not have access to the class or the class name, making logging harder Suggestion: Provide additional context about the class to member decorators tc39/proposal-decorators#466, see this line
  • typescript does not output decorator type metadata for the new ES Decorators
  • a good way to test without having to completely copy the whole test-suite
  • default classes which use decorators cannot be provided anymore because decorator settings may be different than the typegoose project and then be incompatible
  • typescript 5.2 requirement (and waiting for this version to be released)
  • reflect-metadata (or any other) will not be installed / run by default anymore, fixes Allow alternatives to reflect-metadata for shimming reflect metadata API #761

PS: the branch feature/try-new-decorators is just a testing implementation, it is not meant to actually be merged in its current state (its using WIP commits and the tests are not fixed)

@hasezoey hasezoey added the feature Adds a new Feature or Request label Jul 3, 2023
@hasezoey
Copy link
Member Author

hasezoey commented Sep 1, 2023

as a note, typescript 5.2 has now been released (not just beta)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds a new Feature or Request
Projects
None yet
Development

No branches or pull requests

1 participant