I thought decorators were only available in TS not JS. I have seen Angular rely on them to define modules and components; that's why it requires TS.
NestJs too, prefers TS so that it can use decorators to define controller, routing/endpoints for HTTP verbs (get, post, etc).
And we know Java has annotations that serve like TS decorators; we see Spring use annotations for defining REST controller, routing/endpoints for HTTP verbs, similar to what NestJs does with decorators. Oh, maybe NestJs was inspired by Spring in this aspect.
I still lack in TS, that's why I cannot continue learning Angular and NestJs, although the latter supports JS too (but not full support, I think).
Now, with JS through newest ES provides decorators, I can expect to learn NestJs using JS.
Oh.. I am expecting Angular will support JS too.
However, when will the specification of decorators become standard ?
I thought decorators were only available in TS not JS. I have seen Angular rely on them to define modules and components; that's why it requires TS
To be honest, Angular uses a "third-party" compiler. If you're interested, you can read more about it π
Now, with JS through newest ES provides decorators, I can expect to learn NestJs using JS.
Oh.. I am expecting Angular will support JS too.
Unfortunately, it's not quite that simple. In the latest version of Angular, there is support for native JavaScript decorators since TypeScript also supports them. However, NestJS is not in a rush to support these new decorators and currently works only with the old ones (you can reread the section about the history of decorators where I tried to explain everything).
I agree, for someone who is only observing this from the outside, it may seem quite puzzling. However, there are explanations for everything.
However, when will the specification of decorators become standard ?
I very much hope that in the next release or the one after that, we will see native decorators in the language standard. It is high time to put an end to this decade-long confusion, especially since recent TC39 meetings have been focusing on only minor changes.
Thanks for your reply and explanation.
I think, I can wait when decorators become standard. Your examples of using them here are impressive, especially with HOC.
I thought decorators were only available in TS not JS. I have seen Angular rely on them to define modules and components; that's why it requires TS.
NestJs too, prefers TS so that it can use decorators to define controller, routing/endpoints for HTTP verbs (get, post, etc).
And we know Java has annotations that serve like TS decorators; we see Spring use annotations for defining REST controller, routing/endpoints for HTTP verbs, similar to what NestJs does with decorators. Oh, maybe NestJs was inspired by Spring in this aspect.
I still lack in TS, that's why I cannot continue learning Angular and NestJs, although the latter supports JS too (but not full support, I think).
Now, with JS through newest ES provides decorators, I can expect to learn NestJs using JS.
Oh.. I am expecting Angular will support JS too.
However, when will the specification of decorators become standard ?
Hey @lexiebkm !
To be honest, Angular uses a "third-party" compiler. If you're interested, you can read more about it π
Unfortunately, it's not quite that simple. In the latest version of Angular, there is support for native JavaScript decorators since TypeScript also supports them. However, NestJS is not in a rush to support these new decorators and currently works only with the old ones (you can reread the section about the history of decorators where I tried to explain everything).
I agree, for someone who is only observing this from the outside, it may seem quite puzzling. However, there are explanations for everything.
I very much hope that in the next release or the one after that, we will see native decorators in the language standard. It is high time to put an end to this decade-long confusion, especially since recent TC39 meetings have been focusing on only minor changes.
Thanks for your reply and explanation.
I think, I can wait when decorators become standard. Your examples of using them here are impressive, especially with HOC.
Thank you @lexiebkm ! I really love βliveβ examples. Everything is easier with them!