-1

I have a class expression (see MDN - Class Expressions) like this:

const XYZ = class {}

I want to add a decorator like we have in regular classes (see TS Class Decorator) to that, how can I do this?

Adding them before or inline throws an error

  • If you're writing code, and you're confused about an error share the code and the error. We can't guess what you did – Evert Mar 23 '23 at 10:45
  • The question is _kind of_ basic (not really, as TS Decorators are still finding their ground and I really couldn't find out how to do this).. so my question is simply, if you know of ES6 Class expressions (link provided in question), how do you add a TS Class Decorator (also linked in question) to that? – Divyansh Goenka Mar 23 '23 at 13:26
  • Long story short, its in the works (I think?) ? https://github.com/microsoft/TypeScript/issues/7342 For my purposes, I had to use it as a function call and that worked – Divyansh Goenka Mar 24 '23 at 03:47

0 Answers0