diff --git a/closure.log b/closure.log index 98a1f1e2b5..3e35217666 100644 --- a/closure.log +++ b/closure.log @@ -721,7 +721,7 @@ Found : PolymerElement !(window.customElements.polyfillWrapFlushCallback); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_22.js:863: WARNING - Function this.splice: called with 3 argument(s). Function requires at least 4 argument(s) and at most 4. +/polymer.html_script_22.js:855: WARNING - Function this.splice: called with 3 argument(s). Function requires at least 4 argument(s) and at most 4. return this.splice(arrayOrPath, index, 1); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -816,140 +816,140 @@ Found : $polymer_html_script_26$classdecl$var2<|function(new:$polymer_html_sc this._flushProperties(); ^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:276: WARNING - Property disconnectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype +/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:277: WARNING - Cannot add property __isDetached to a struct instance after it is constructed. +/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:284: WARNING - Property connectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype +/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:288: WARNING - Property parentNode never defined on this of type DomRepeat{__isDetached:boolean} +/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:300: WARNING - Cannot add property template to a struct instance after it is constructed. +/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:300: WARNING - Property querySelector never defined on this of type DomRepeat +/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:304: WARNING - Property querySelector never defined on $jscomp$this of type DomRepeat +/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:311: WARNING - Invalid type for parameter 1 of function observer.observe. +/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:316: WARNING - Property as never defined on this of type DomRepeat +/polymer.html_script_30.js:318: WARNING - Property as never defined on this of type DomRepeat instanceProps[this.as] = true; ^^^^^^^ -/polymer.html_script_30.js:317: WARNING - Property indexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:319: WARNING - Property indexAs never defined on this of type DomRepeat instanceProps[this.indexAs] = true; ^^^^^^^^^^^^ -/polymer.html_script_30.js:318: WARNING - Property itemsIndexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:320: WARNING - Property itemsIndexAs never defined on this of type DomRepeat instanceProps[this.itemsIndexAs] = true; ^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:320: WARNING - Property mutableData never defined on this of type DomRepeat +/polymer.html_script_30.js:322: WARNING - Property mutableData never defined on this of type DomRepeat mutableData: this.mutableData, ^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:324: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:326: WARNING - Dangerous use of the global THIS object let i$ = this.__instances; ^^^^ -/polymer.html_script_30.js:330: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:332: WARNING - Dangerous use of the global THIS object if (Polymer.Path.matches(this.as, prop)) { ^^^^ -/polymer.html_script_30.js:331: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:333: WARNING - Dangerous use of the global THIS object let idx = inst[this.itemsIndexAs]; ^^^^ -/polymer.html_script_30.js:332: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:334: WARNING - Dangerous use of the global THIS object if (prop == this.as) { ^^^^ -/polymer.html_script_30.js:333: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:335: WARNING - Dangerous use of the global THIS object this.items[idx] = value; ^^^^ -/polymer.html_script_30.js:335: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:337: WARNING - Dangerous use of the global THIS object let path = Polymer.Path.translate(this.as, 'items.' + idx, prop); ^^^^ -/polymer.html_script_30.js:336: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:338: WARNING - Dangerous use of the global THIS object this.notifyPath(path, value); ^^^^ -/polymer.html_script_30.js:350: WARNING - Property __dataHost never defined on this of type DomRepeat +/polymer.html_script_30.js:352: WARNING - Property __dataHost never defined on this of type DomRepeat return this.__dataHost._methodHost || this.__dataHost; ^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:359: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:361: WARNING - Invalid type for parameter 1 of function this.__debounceRender. Expected : function():? Found : function(this:DomRepeat):? this.__debounceRender(this.__render); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:369: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:371: WARNING - Invalid type for parameter 1 of function this.__debounceRender. Expected : function():? Found : function(this:DomRepeat):? this.__debounceRender(this.__render); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:389: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:391: WARNING - Invalid type for parameter 1 of function this.__debounceRender. Expected : function():? Found : function(this:DomRepeat):? this.__debounceRender(this.__requestRenderChunk); ^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:402: WARNING - Property _targetFrameTime never defined on this of type DomRepeat +/polymer.html_script_30.js:404: WARNING - Property _targetFrameTime never defined on this of type DomRepeat let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime); ^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:406: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:408: WARNING - Invalid type for parameter 1 of function this.__debounceRender. Expected : function():? Found : function(this:DomRepeat):? this.__debounceRender(this.__render); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:425: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:427: WARNING - Invalid type for parameter 1 of function this.__debounceRender. Expected : function():? Found : function(this:DomRepeat):? this.__debounceRender(this.__render); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:436: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:438: WARNING - Invalid type for parameter 1 of function this.__debounceRender. Expected : function():? Found : function(this:DomRepeat):? this.__debounceRender(this.__render, this.delay); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:436: WARNING - Property delay never defined on this of type DomRepeat{__needFullRefresh:boolean, __observePaths:truthy} +/polymer.html_script_30.js:438: WARNING - Property delay never defined on this of type DomRepeat{__needFullRefresh:boolean, __observePaths:truthy} this.__debounceRender(this.__render, this.delay); ^^^^^^^^^^ -/polymer.html_script_30.js:450: WARNING - Invalid type for parameter 1 of function Polymer.Async.timeOut.after. +/polymer.html_script_30.js:452: WARNING - Invalid type for parameter 1 of function Polymer.Async.timeOut.after. Expected : number Found : number|undefined More details: @@ -957,87 +957,78 @@ The found type is a union that includes an unexpected type: undefined , delay > 0 ? Polymer.Async.timeOut.after(delay) : Polymer.Async.microTask ^^^^^ -/polymer.html_script_30.js:465: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:467: WARNING - Invalid type for parameter 1 of function this.__debounceRender. Expected : function():? Found : function(this:DomRepeat):? this.__debounceRender(this.__render); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:482: WARNING - Property _setRenderedItemCount never defined on this of type DomRepeat{__pool:{length:number} (loose)} +/polymer.html_script_30.js:484: WARNING - Property _setRenderedItemCount never defined on this of type DomRepeat{__pool:{length:number} (loose)} this._setRenderedItemCount(this.__instances.length); ^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:484: WARNING - Property dispatchEvent never defined on this of type DomRepeat{__instances:{length:?} (loose), __pool:{length:number} (loose)} +/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:493: WARNING - All constants must be typed. The compiler could not infer the type of constant items. Please use an explicit type annotation. For more information, see: -https://github.com/google/closure-compiler/wiki/Using-NTI-(new-type-inference)#warnings-about-uninferred-constants - const items = this.items || []; - ^^^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_30.js:518: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} +/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); ^^^^^^^ -/polymer.html_script_30.js:519: WARNING - Property indexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} +/polymer.html_script_30.js:521: WARNING - Property indexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} inst._setPendingProperty(this.indexAs, instIdx); ^^^^^^^^^^^^ -/polymer.html_script_30.js:520: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} +/polymer.html_script_30.js:522: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} inst._setPendingProperty(this.itemsIndexAs, itemIdx); ^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:556: WARNING - Property as never defined on this of type DomRepeat +/polymer.html_script_30.js:558: WARNING - Property as never defined on this of type DomRepeat model[this.as] = item; ^^^^^^^ -/polymer.html_script_30.js:557: WARNING - Property indexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:559: WARNING - Property indexAs never defined on this of type DomRepeat model[this.indexAs] = instIdx; ^^^^^^^^^^^^ -/polymer.html_script_30.js:558: WARNING - Property itemsIndexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:560: WARNING - Property itemsIndexAs never defined on this of type DomRepeat model[this.itemsIndexAs] = itemIdx; ^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:567: WARNING - Property as never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/polymer.html_script_30.js:569: WARNING - Property as never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} inst._setPendingProperty(this.as, item); ^^^^^^^ -/polymer.html_script_30.js:568: WARNING - Property indexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/polymer.html_script_30.js:570: WARNING - Property indexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} inst._setPendingProperty(this.indexAs, instIdx); ^^^^^^^^^^^^ -/polymer.html_script_30.js:569: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/polymer.html_script_30.js:571: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} inst._setPendingProperty(this.itemsIndexAs, itemIdx); ^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:576: WARNING - Property parentNode never defined on this of type DomRepeat{__instances:Object, __pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/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:603: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object} +/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 : ''); ^^^^^^^ -/polymer.html_script_30.js:627: WARNING - Property as never defined on this of type DomRepeat +/polymer.html_script_30.js:629: WARNING - Property as never defined on this of type DomRepeat return instance && instance[this.as]; ^^^^^^^ -/polymer.html_script_30.js:641: WARNING - Property indexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:643: WARNING - Property indexAs never defined on this of type DomRepeat return instance && instance[this.indexAs]; ^^^^^^^^^^^^ -/polymer.html_script_30.js:658: WARNING - Type annotation references non-existent type TemplateInstanceBase. - * @return {TemplateInstanceBase} Model representing the binding scope for - ^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_30.js:662: WARNING - Property template never defined on this of type DomRepeat +/polymer.html_script_30.js:664: WARNING - Property template never defined on this of type DomRepeat return Polymer.Templatize.modelForElement(this.template, el); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:667: WARNING - Invalid type for parameter 2 of function customElements.define. +/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|> @@ -1379,10 +1370,6 @@ externs/closure-types.js:399: WARNING - property attributeChangedCallback not de Polymer_ElementMixin.prototype.attributeChangedCallback = function(name, old, value){}; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -externs/closure-types.js:528: WARNING - Type annotation references non-existent type fireOptions. -* @param {fireOptions=} options - ^^^^^^^^^^^ - externs/closure-types.js:733: WARNING - property mutableData on interface Polymer_OptionalMutableData is not implemented by type OptionalMutableData Polymer_OptionalMutableData.prototype.mutableData; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1407,4 +1394,4 @@ externs/closure-types.js:759: WARNING - property toggle on interface Polymer_Arr Polymer_ArraySelectorMixin.prototype.toggle; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -0 error(s), 307 warning(s), 72.6% typed +0 error(s), 304 warning(s), 72.7% typed diff --git a/externs/closure-types.js b/externs/closure-types.js index 70eb2de07d..0641bc943a 100644 --- a/externs/closure-types.js +++ b/externs/closure-types.js @@ -525,7 +525,7 @@ Polymer_LegacyElementMixin.prototype.instanceTemplate = function(template){}; /** * @param {string} type * @param {*=} detail -* @param {fireOptions=} options +* @param {{bubbles: (boolean|undefined), cancelable: (boolean|undefined), composed: (boolean|undefined)}=} options * @return {Event} */ Polymer_LegacyElementMixin.prototype.fire = function(type, detail, options){}; diff --git a/lib/elements/dom-repeat.html b/lib/elements/dom-repeat.html index 5efa30a43d..2d14691987 100644 --- a/lib/elements/dom-repeat.html +++ b/lib/elements/dom-repeat.html @@ -18,6 +18,8 @@ (function() { 'use strict'; + let TemplateInstanceBase = Polymer.TemplateInstanceBase; // eslint-disable-line + /** * @constructor * @implements {Polymer_OptionalMutableData} @@ -506,7 +508,7 @@ } __applyFullRefresh() { - const items = this.items || []; + let items = this.items || []; let isntIdxToItemsIdx = new Array(items.length); for (let i=0; i