-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
strip: Class fields should be assigned after parameter properties #930
Comments
This is handled by class properties pass. Note that class properties pass inject some helpers and you need InjectHelper pass. (I don't know why. I just looked at the output from the babel and write code to emit same output.) If it's not acceptable, I can modify typescript pass to do it or class properties pass not to inject helper |
Seems like So I think:
is a better way to handler this situation. And because |
I think modifying class_properties pass to accept mode is better than modifying typescript_strip pass because typescript also supports |
Now there exists a |
@kdy1 I'm still seeing this issue in |
@nayeemrmn I forgot to add |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Input code
TypeScript allows regular class fields to depend on parameter properties:
Output code (actual)
The regular class field
b
is incorrectly initialised before the parameter propertya
:Output code (expected)
The correct ordering is, parameter property assignment -> class field initialisation -> rest of the constructor. So if there are parameter properties present (or always), the class field initialisation must be moved below their assignments in the constructor:
This is the official compiler's output.
Seen in https://github.com/denoland/deno/blob/v1.2.2/std/mime/multipart.ts#L263-L271
cc @bartlomieju
The text was updated successfully, but these errors were encountered: