Skip to content

Commit

Permalink
fix typing for Polymer.Element
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Apr 27, 2017
1 parent c3da507 commit 0b15293
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 88 deletions.
89 changes: 1 addition & 88 deletions closure.log
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,6 @@ Found : PolymerElement
return super._parseTemplateContent(template, templateInfo, nodeInfo);
^^^^^^^^^^^^^^^^^^^^^^^^^^^

/polymer.html_script_11.js:862: WARNING - Type annotation references non-existent type Polymer.Element.
* @type {Array<Polymer.Element>}
^^^^^^^^^^^^^^^

/polymer.html_script_11.js:870: WARNING - Property is never defined on prototype of type HTMLElement
console.log('[' + prototype.is + ']: registered')
^^^^^^^^^^^^
Expand Down Expand Up @@ -768,41 +764,14 @@ Found : $polymer_html_script_26$classdecl$var2<|function(new:$polymer_html_sc
this._flushProperties();
^^^^^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:278: WARNING - Property disconnectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype
super.disconnectedCallback();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:279: WARNING - Cannot add property __isDetached to a struct instance after it is constructed.
this.__isDetached = true;
^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:286: WARNING - Property connectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype
super.connectedCallback();
^^^^^^^^^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:290: WARNING - Property parentNode never defined on this of type DomRepeat{__isDetached:boolean}
let parent = this.parentNode;
^^^^^^^^^^^^^^^

/polymer.html_script_30.js:302: WARNING - Cannot add property template to a struct instance after it is constructed.
let template = this.template = this.querySelector('template');
^^^^^^^^^^^^^

/polymer.html_script_30.js:302: WARNING - Property querySelector never defined on this of type DomRepeat
let template = this.template = this.querySelector('template');
^^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:306: WARNING - Property querySelector never defined on $jscomp$this of type DomRepeat
if (this.querySelector('template')) {
^^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:313: WARNING - Invalid type for parameter 1 of function observer.observe.
Expected : Node|null
Found : DomRepeat

observer.observe(this, {childList: true});
^^^^

/polymer.html_script_30.js:318: WARNING - Property as never defined on this of type DomRepeat
instanceProps[this.as] = true;
^^^^^^^
Expand Down Expand Up @@ -920,10 +889,6 @@ Found : function(this:DomRepeat):?
this._setRenderedItemCount(this.__instances.length);
^^^^^^^^^^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:486: WARNING - Property dispatchEvent never defined on this of type DomRepeat{__instances:{length:?} (loose), __pool:{length:number} (loose)}
this.dispatchEvent(new CustomEvent('dom-change', {
^^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:520: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=}
inst._setPendingProperty(this.as, item);
^^^^^^^
Expand Down Expand Up @@ -960,10 +925,6 @@ Found : function(this:DomRepeat):?
inst._setPendingProperty(this.itemsIndexAs, itemIdx);
^^^^^^^^^^^^^^^^^

/polymer.html_script_30.js:578: WARNING - Property parentNode never defined on this of type DomRepeat{__instances:Object, __pool:{pop:LOOSE_TOP_FUNCTION} (loose)}
this.parentNode.insertBefore(inst.root, beforeNode);
^^^^^^^^^^^^^^^

/polymer.html_script_30.js:605: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object}
let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : '');
^^^^^^^
Expand All @@ -980,44 +941,14 @@ Found : function(this:DomRepeat):?
return Polymer.Templatize.modelForElement(this.template, el);
^^^^^^^^^^^^^

/polymer.html_script_30.js:669: WARNING - Invalid type for parameter 2 of function customElements.define.
Expected : function(new:HTMLElement):?
Found : DomRepeat<|function(new:DomRepeat):undefined|>

customElements.define(DomRepeat.is, DomRepeat);
^^^^^^^^^

/polymer.html_script_31.js:142: WARNING - Property _lastIf never defined on this of type DomIf{__instance:?, if:?=, restamp:?=}
if (this.if != this._lastIf) {
^^^^^^^^^^^^

/polymer.html_script_31.js:143: WARNING - Property dispatchEvent never defined on this of type DomIf{__instance:?, if:?=, restamp:?=}
this.dispatchEvent(new CustomEvent('dom-change', {
^^^^^^^^^^^^^^^^^^

/polymer.html_script_31.js:147: WARNING - Cannot add property _lastIf to a struct instance after it is constructed.
this._lastIf = this.if;
^^^^^^^^^^^^

/polymer.html_script_31.js:152: WARNING - Property parentNode never defined on this of type DomIf
let parentNode = this.parentNode;
^^^^^^^^^^^^^^^

/polymer.html_script_31.js:156: WARNING - Property querySelector never defined on this of type DomIf
let template = this.querySelector('template');
^^^^^^^^^^^^^^^^^^

/polymer.html_script_31.js:160: WARNING - Property querySelector never defined on $jscomp$this of type DomIf
if (this.querySelector('template')) {
^^^^^^^^^^^^^^^^^^

/polymer.html_script_31.js:167: WARNING - Invalid type for parameter 1 of function observer.observe.
Expected : Node|null
Found : DomIf

observer.observe(this, {childList: true});
^^^^

/polymer.html_script_31.js:170: WARNING - Cannot add property __ctor to a struct instance after it is constructed.
this.__ctor = Polymer.Templatize.templatize(template, this, {
^^^^^^^^^^^
Expand Down Expand Up @@ -1046,10 +977,6 @@ Found : DomIf
this.__invalidProps[Polymer.Path.root(prop)] = true;
^^^^

/polymer.html_script_31.js:198: WARNING - Property previousSibling never defined on this of type DomIf{__ctor:truthy=, __instance:{children:?} (loose)}
let lastChild = this.previousSibling;
^^^^^^^^^^^^^^^^^^^^

/polymer.html_script_31.js:214: WARNING - Property __dataHost never defined on this of type DomIf{__instance:{_setPendingProperty:LOOSE_TOP_FUNCTION} (loose)}
this.__instance._setPendingProperty(prop, this.__dataHost[prop]);
^^^^^^^^^^^^^^^
Expand All @@ -1058,13 +985,6 @@ Found : DomIf
let hidden = this.__hideTemplateChildren__ || !this.if;
^^^^^^^

/polymer.html_script_31.js:245: WARNING - Invalid type for parameter 2 of function customElements.define.
Expected : function(new:HTMLElement):?
Found : DomIf<|function(new:DomIf):undefined|>

customElements.define(DomIf.is, DomIf);
^^^^^

/polymer.html_script_32.js:143: WARNING - Property items never defined on this of type ArraySelectorMixin
if (selected.has(this.items[idx])) {
^^^^^^^^^^
Expand Down Expand Up @@ -1157,13 +1077,6 @@ Found : DomIf<|function(new:DomIf):undefined|>
this.selected = this.selectedItem = item;
^^^^^^^^^^^^^^^^^

/polymer.html_script_32.js:391: WARNING - Invalid type for parameter 2 of function customElements.define.
Expected : function(new:HTMLElement):?
Found : ArraySelector<|function(new:ArraySelector,...?):undefined|>

customElements.define(ArraySelector.is, ArraySelector);
^^^^^^^^^^^^^

/polymer.html_script_33.js:47: WARNING - Returned type does not match declared return type.
Expected : HTMLStyleElement|null
Found : undefined
Expand Down Expand Up @@ -1346,4 +1259,4 @@ externs/closure-types.js:762: WARNING - property toggle on interface Polymer_Arr
Polymer_ArraySelectorMixin.prototype.toggle;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 error(s), 293 warning(s), 72.8% typed
0 error(s), 275 warning(s), 74.5% typed
5 changes: 5 additions & 0 deletions polymer-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
* attribute deserialization, and property change observation
*/
const Element = Polymer.ElementMixin(HTMLElement);
/**
* @constructor
* @implements {Polymer_ElementMixin}
* @extends {HTMLElement}
*/
Polymer.Element = Element;
})();
</script>

0 comments on commit 0b15293

Please sign in to comment.