Allow mixin classes to have members added via .prototype calls.#799
Merged
Allow mixin classes to have members added via .prototype calls.#799
Conversation
Demonstrates problem where analyzer does not detect mixin class properties that are added to the prototype.
For example: /** @type {string} */ MyMixin.prototype.foo; We already support this behavior for normal classes, but not for mixin classes.
e760650 to
1eb481f
Compare
Contributor
|
We can also do this via: /** @type {string} */
this.foo;in the constructor, which I'd argue is more legible. I guess if that's the only thing in the constructor it might be better for the VM to leave it off though? |
rictic
approved these changes
Dec 2, 2018
Member
Author
Yeah @kevinpschaaf and @sorvell specifically wanted to avoid having the property accesses at all in the constructor, for uncompiled users. |
aomarks
added a commit
to Polymer/polymer
that referenced
this pull request
Dec 6, 2018
Only significant change is from Polymer/tools#799
aomarks
added a commit
to Polymer/polymer
that referenced
this pull request
Dec 6, 2018
Only interesting change is from Polymer/tools#799
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For example:
We already support this behavior for normal classes, but not for mixin classes.
We need this because we're going to change some class mixin properties such as
PolymerElement._templateto not be initialized in the constructor, but we still need a way to tell analyzer that they exist.cc @sorvell @kevinpschaaf