-
Notifications
You must be signed in to change notification settings - Fork 16
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
moveControllerPropsToOnInit
should not move explicit constructor content
#13
Comments
@Elberet . I'll have a look at that. I've never had a use for Something you might already be aware of is that in ES2015 classes, you should not use Also, are you using version 6.x or 7.x (release candidate)? They'd both have the same behaviour for this, but just curious. Ryan |
I'm using 7.0.0-rc.2. Also, yes, I know that |
@Elberet Please give rc3 a try. This version has a breaking change in your favour, where I added a new option I also remembered that you could put the following jsdoc on a constructor to keep it. /**
* @keep
*/
constructor() {} That wouldn't be needed for you with the new default behaviour, but if you enabled I think this new default is the better approach anyways as that |
Seems to work; statements before super appear in the constructor before the transpiled super call, everything else gets moved to the top of onInit() just below property initializers. 👍 |
When the
moveControllerPropsToOnInit
option is enabled and a custom constructor is present at the same time, the entire content of the constructor is moved toonInit()
:Input:
Output:
While it's understandably necessary to move constructor content after
super
to where it is executed after the moved props have been initialized, statements that appear beforesuper
should remain in the constructor and run before the call to the super constructor.An example where this is required is when trying to pass data from the HTML page through a component to the application's root view - i.e., I would like the transpiled code to look something like this:
Fantastic work on the plugin, by the way. With this in an easy-to-use build pipeline I can finally
forceinspire my colleagues to learn modern JS! 😈The text was updated successfully, but these errors were encountered: