pzuraq / macro-decorators

Decorators for getter/setter macros!
https://pzuraq.github.io/macro-decorators/
MIT License
62 stars 10 forks source link

Add example to docs showing how to use with Typescript #29

Open lukemelia opened 3 years ago

lukemelia commented 3 years ago

I love this library for working in JS but am not sure how it should be used in Typescript. In other words, how do we type the properties defined via these decorators?

pzuraq commented 3 years ago

I'm open to ideas here, I don't really use these decorators that much myself these days. They can be useful, but I also think that they're not going to really match up well with the current direction of the decorators spec. You would have to do:

@alias('foo') accessor bar;

The accessor keyword will be necessary for converting a field into a getter/setter. In some cases, this could possibly still be worth it for terseness, but I don't think it would be in many simple cases like aliasing.