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
Static/member methods cannot access the replaced decorated class #477
Comments
This should work. In the spec text the binding of the class name comes after running class decorators
|
@senocular is correct here, this is the behavior of the spec, the bound name of the class is the same, decorated version of the class everywhere. @xaviergonz which transform are you using? I wasn't aware that TS had shipped the most recent version of the spec yet, are you using the legacy/experimental version from before? |
Good to know! The transform I was using to test it out (and therefore the one that apparently is wrong) is the one at https://javascriptdecorators.org/ |
For sure, so that transform is likely out of date at this point, @pabloalmunia it may be a good idea to put a notice on the site that users should update to using the latest Babel or Typescript transforms once they're available. @xaviergonz that transform is not going to be supported going forward. You should use the 03/22 transform from Babel once it ships: babel/babel#14836, or use the Typescript transform once it ships, as those will be the most accurate relative to the actual spec. Closing this for now since it appears to be addressed. |
Of course. The experimental transpiler is outdated. It had its usefulness, but it will soon become meaningless. |
Given the following
I'd expect all of them to return an instance of the decorated class, but new returns the decorated one and the others the undecorated one (at least in the independent playground).
Typescript decorators do return the decorated class in every case. I'm not sure what's the intended behaviour, but whichever it is, maybe it should be documented in the spec?
The text was updated successfully, but these errors were encountered: