From 80f54421fcffeda269fa387d86a297455b615b05 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Wed, 26 Apr 2017 14:07:45 -0700 Subject: [PATCH 01/47] fix some closure warnings. --- lib/utils/array-splice.html | 468 ++++++++++++------------ lib/utils/flattened-nodes-observer.html | 23 +- lib/utils/import-href.html | 6 +- 3 files changed, 250 insertions(+), 247 deletions(-) diff --git a/lib/utils/array-splice.html b/lib/utils/array-splice.html index 9008ebffe8..b9ac24cd71 100644 --- a/lib/utils/array-splice.html +++ b/lib/utils/array-splice.html @@ -26,254 +26,250 @@ const EDIT_ADD = 2; const EDIT_DELETE = 3; - const ArraySplice = { - - // Note: This function is *based* on the computation of the Levenshtein - // "edit" distance. The one change is that "updates" are treated as two - // edits - not one. With Array splices, an update is really a delete - // followed by an add. By retaining this, we optimize for "keeping" the - // maximum array items in the original array. For example: - // - // 'xxxx123' -> '123yyyy' - // - // With 1-edit updates, the shortest path would be just to update all seven - // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This - // leaves the substring '123' intact. - calcEditDistances(current, currentStart, currentEnd, - old, oldStart, oldEnd) { - // "Deletion" columns - let rowCount = oldEnd - oldStart + 1; - let columnCount = currentEnd - currentStart + 1; - let distances = new Array(rowCount); - - // "Addition" rows. Initialize null column. - for (let i = 0; i < rowCount; i++) { - distances[i] = new Array(columnCount); - distances[i][0] = i; - } + // Note: This function is *based* on the computation of the Levenshtein + // "edit" distance. The one change is that "updates" are treated as two + // edits - not one. With Array splices, an update is really a delete + // followed by an add. By retaining this, we optimize for "keeping" the + // maximum array items in the original array. For example: + // + // 'xxxx123' -> '123yyyy' + // + // With 1-edit updates, the shortest path would be just to update all seven + // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This + // leaves the substring '123' intact. + function calcEditDistances(current, currentStart, currentEnd, + old, oldStart, oldEnd) { + // "Deletion" columns + let rowCount = oldEnd - oldStart + 1; + let columnCount = currentEnd - currentStart + 1; + let distances = new Array(rowCount); + + // "Addition" rows. Initialize null column. + for (let i = 0; i < rowCount; i++) { + distances[i] = new Array(columnCount); + distances[i][0] = i; + } - // Initialize null row - for (let j = 0; j < columnCount; j++) - distances[0][j] = j; - - for (let i = 1; i < rowCount; i++) { - for (let j = 1; j < columnCount; j++) { - if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1])) - distances[i][j] = distances[i - 1][j - 1]; - else { - let north = distances[i - 1][j] + 1; - let west = distances[i][j - 1] + 1; - distances[i][j] = north < west ? north : west; - } + // Initialize null row + for (let j = 0; j < columnCount; j++) + distances[0][j] = j; + + for (let i = 1; i < rowCount; i++) { + for (let j = 1; j < columnCount; j++) { + if (equals(current[currentStart + j - 1], old[oldStart + i - 1])) + distances[i][j] = distances[i - 1][j - 1]; + else { + let north = distances[i - 1][j] + 1; + let west = distances[i][j - 1] + 1; + distances[i][j] = north < west ? north : west; } } + } - return distances; - }, - - // This starts at the final weight, and walks "backward" by finding - // the minimum previous weight recursively until the origin of the weight - // matrix. - spliceOperationsFromEditDistances(distances) { - let i = distances.length - 1; - let j = distances[0].length - 1; - let current = distances[i][j]; - let edits = []; - while (i > 0 || j > 0) { - if (i == 0) { - edits.push(EDIT_ADD); - j--; - continue; - } - if (j == 0) { - edits.push(EDIT_DELETE); - i--; - continue; - } - let northWest = distances[i - 1][j - 1]; - let west = distances[i - 1][j]; - let north = distances[i][j - 1]; - - let min; - if (west < north) - min = west < northWest ? west : northWest; - else - min = north < northWest ? north : northWest; - - if (min == northWest) { - if (northWest == current) { - edits.push(EDIT_LEAVE); - } else { - edits.push(EDIT_UPDATE); - current = northWest; - } - i--; - j--; - } else if (min == west) { - edits.push(EDIT_DELETE); - i--; - current = west; + return distances; + } + + // This starts at the final weight, and walks "backward" by finding + // the minimum previous weight recursively until the origin of the weight + // matrix. + function spliceOperationsFromEditDistances(distances) { + let i = distances.length - 1; + let j = distances[0].length - 1; + let current = distances[i][j]; + let edits = []; + while (i > 0 || j > 0) { + if (i == 0) { + edits.push(EDIT_ADD); + j--; + continue; + } + if (j == 0) { + edits.push(EDIT_DELETE); + i--; + continue; + } + let northWest = distances[i - 1][j - 1]; + let west = distances[i - 1][j]; + let north = distances[i][j - 1]; + + let min; + if (west < north) + min = west < northWest ? west : northWest; + else + min = north < northWest ? north : northWest; + + if (min == northWest) { + if (northWest == current) { + edits.push(EDIT_LEAVE); } else { - edits.push(EDIT_ADD); - j--; - current = north; + edits.push(EDIT_UPDATE); + current = northWest; } + i--; + j--; + } else if (min == west) { + edits.push(EDIT_DELETE); + i--; + current = west; + } else { + edits.push(EDIT_ADD); + j--; + current = north; } + } - edits.reverse(); - return edits; - }, + edits.reverse(); + return edits; + } - /** - * Splice Projection functions: - * - * A splice map is a representation of how a previous array of items - * was transformed into a new array of items. Conceptually it is a list of - * tuples of - * - * - * - * which are kept in ascending index order of. The tuple represents that at - * the |index|, |removed| sequence of items were removed, and counting forward - * from |index|, |addedCount| items were added. - */ + /** + * Splice Projection functions: + * + * A splice map is a representation of how a previous array of items + * was transformed into a new array of items. Conceptually it is a list of + * tuples of + * + * + * + * which are kept in ascending index order of. The tuple represents that at + * the |index|, |removed| sequence of items were removed, and counting forward + * from |index|, |addedCount| items were added. + */ - /** - * Lacking individual splice mutation information, the minimal set of - * splices can be synthesized given the previous state and final state of an - * array. The basic approach is to calculate the edit distance matrix and - * choose the shortest path through it. - * - * Complexity: O(l * p) - * l: The length of the current array - * p: The length of the old array - * - * @param {Array} current The current "changed" array for which to - * calculate splices. - * @param {number} currentStart Starting index in the `current` array for - * which splices are calculated. - * @param {number} currentEnd Ending index in the `current` array for - * which splices are calculated. - * @param {Array} old The original "unchanged" array to compare `current` - * against to determine splices. - * @param {number} oldStart Starting index in the `old` array for - * which splices are calculated. - * @param {number} oldEnd Ending index in the `old` array for - * which splices are calculated. - * @return {Array} Returns an array of splice record objects. Each of these - * contains: `index` the location where the splice occurred; `removed` - * the array of removed items from this location; `addedCount` the number - * of items added at this location. - */ - calcSplices(current, currentStart, currentEnd, - old, oldStart, oldEnd) { - let prefixCount = 0; - let suffixCount = 0; - let splice; - - let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart); - if (currentStart == 0 && oldStart == 0) - prefixCount = this.sharedPrefix(current, old, minLength); - - if (currentEnd == current.length && oldEnd == old.length) - suffixCount = this.sharedSuffix(current, old, minLength - prefixCount); - - currentStart += prefixCount; - oldStart += prefixCount; - currentEnd -= suffixCount; - oldEnd -= suffixCount; - - if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) - return []; - - if (currentStart == currentEnd) { - splice = newSplice(currentStart, [], 0); - while (oldStart < oldEnd) - splice.removed.push(old[oldStart++]); - - return [ splice ]; - } else if (oldStart == oldEnd) - return [ newSplice(currentStart, [], currentEnd - currentStart) ]; - - let ops = this.spliceOperationsFromEditDistances( - this.calcEditDistances(current, currentStart, currentEnd, - old, oldStart, oldEnd)); - - splice = undefined; - let splices = []; - let index = currentStart; - let oldIndex = oldStart; - for (let i = 0; i < ops.length; i++) { - switch(ops[i]) { - case EDIT_LEAVE: - if (splice) { - splices.push(splice); - splice = undefined; - } - - index++; - oldIndex++; - break; - case EDIT_UPDATE: - if (!splice) - splice = newSplice(index, [], 0); - - splice.addedCount++; - index++; - - splice.removed.push(old[oldIndex]); - oldIndex++; - break; - case EDIT_ADD: - if (!splice) - splice = newSplice(index, [], 0); - - splice.addedCount++; - index++; - break; - case EDIT_DELETE: - if (!splice) - splice = newSplice(index, [], 0); - - splice.removed.push(old[oldIndex]); - oldIndex++; - break; - } - } + /** + * Lacking individual splice mutation information, the minimal set of + * splices can be synthesized given the previous state and final state of an + * array. The basic approach is to calculate the edit distance matrix and + * choose the shortest path through it. + * + * Complexity: O(l * p) + * l: The length of the current array + * p: The length of the old array + * + * @param {Array} current The current "changed" array for which to + * calculate splices. + * @param {number} currentStart Starting index in the `current` array for + * which splices are calculated. + * @param {number} currentEnd Ending index in the `current` array for + * which splices are calculated. + * @param {Array} old The original "unchanged" array to compare `current` + * against to determine splices. + * @param {number} oldStart Starting index in the `old` array for + * which splices are calculated. + * @param {number} oldEnd Ending index in the `old` array for + * which splices are calculated. + * @return {Array} Returns an array of splice record objects. Each of these + * contains: `index` the location where the splice occurred; `removed` + * the array of removed items from this location; `addedCount` the number + * of items added at this location. + */ + function calcSplices(current, currentStart, currentEnd, + old, oldStart, oldEnd) { + let prefixCount = 0; + let suffixCount = 0; + let splice; + + let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart); + if (currentStart == 0 && oldStart == 0) + prefixCount = sharedPrefix(current, old, minLength); + + if (currentEnd == current.length && oldEnd == old.length) + suffixCount = sharedSuffix(current, old, minLength - prefixCount); + + currentStart += prefixCount; + oldStart += prefixCount; + currentEnd -= suffixCount; + oldEnd -= suffixCount; + + if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) + return []; + + if (currentStart == currentEnd) { + splice = newSplice(currentStart, [], 0); + while (oldStart < oldEnd) + splice.removed.push(old[oldStart++]); + + return [ splice ]; + } else if (oldStart == oldEnd) + return [ newSplice(currentStart, [], currentEnd - currentStart) ]; + + let ops = spliceOperationsFromEditDistances( + calcEditDistances(current, currentStart, currentEnd, + old, oldStart, oldEnd)); + + splice = undefined; + let splices = []; + let index = currentStart; + let oldIndex = oldStart; + for (let i = 0; i < ops.length; i++) { + switch(ops[i]) { + case EDIT_LEAVE: + if (splice) { + splices.push(splice); + splice = undefined; + } - if (splice) { - splices.push(splice); + index++; + oldIndex++; + break; + case EDIT_UPDATE: + if (!splice) + splice = newSplice(index, [], 0); + + splice.addedCount++; + index++; + + splice.removed.push(old[oldIndex]); + oldIndex++; + break; + case EDIT_ADD: + if (!splice) + splice = newSplice(index, [], 0); + + splice.addedCount++; + index++; + break; + case EDIT_DELETE: + if (!splice) + splice = newSplice(index, [], 0); + + splice.removed.push(old[oldIndex]); + oldIndex++; + break; } - return splices; - }, - - sharedPrefix(current, old, searchLength) { - for (let i = 0; i < searchLength; i++) - if (!this.equals(current[i], old[i])) - return i; - return searchLength; - }, - - sharedSuffix(current, old, searchLength) { - let index1 = current.length; - let index2 = old.length; - let count = 0; - while (count < searchLength && this.equals(current[--index1], old[--index2])) - count++; - - return count; - }, - - calculateSplices(current, previous) { - return this.calcSplices(current, 0, current.length, previous, 0, - previous.length); - }, - - equals(currentValue, previousValue) { - return currentValue === previousValue; } - }; + if (splice) { + splices.push(splice); + } + return splices; + } + + function sharedPrefix(current, old, searchLength) { + for (let i = 0; i < searchLength; i++) + if (!equals(current[i], old[i])) + return i; + return searchLength; + } + + function sharedSuffix(current, old, searchLength) { + let index1 = current.length; + let index2 = old.length; + let count = 0; + while (count < searchLength && equals(current[--index1], old[--index2])) + count++; + + return count; + } + + function calculateSplices(current, previous) { + return calcSplices(current, 0, current.length, previous, 0, + previous.length); + } + + function equals(currentValue, previousValue) { + return currentValue === previousValue; + } /** * @namespace @@ -312,9 +308,7 @@ * the array of removed items from this location; `addedCount` the number * of items added at this location. */ - calculateSplices(current, previous) { - return ArraySplice.calculateSplices(current, previous); - } + calculateSplices } })(); diff --git a/lib/utils/flattened-nodes-observer.html b/lib/utils/flattened-nodes-observer.html index c1f75d038b..da8292d47a 100644 --- a/lib/utils/flattened-nodes-observer.html +++ b/lib/utils/flattened-nodes-observer.html @@ -14,6 +14,12 @@ (function() { 'use strict'; + /** + * Returns true if `node` is a slot element + * @param {HTMLElement} node Node to test. + * @return {boolean} Returns true if the given `node` is a slot + * @private + */ function isSlot(node) { return (node.localName === 'slot'); } @@ -39,9 +45,6 @@ * are asynchronous. * * @memberof Polymer - * @param {Node} target Node on which to listen for changes. - * @param {Function} callback Function called when there are additions - * or removals from the target's list of flattened nodes. * @summary Class that listens for changes (additions or removals) to * "flattened nodes" on a given `node`. */ @@ -56,16 +59,16 @@ * nodes list is `
`. If the `` has other * `` elements assigned to it, these are flattened as well. * - * @param {Node} node The node for which to return the list of flattened nodes. + * @param {HTMLElement|HTMLSlotElement} node The node for which to return the list of flattened nodes. * @return {Array} The list of flattened nodes for the given `node`. */ static getFlattenedNodes(node) { if (isSlot(node)) { - return node.assignedNodes({flatten: true}); + return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true}); } else { return Array.from(node.childNodes).map(node => { if (isSlot(node)) { - return node.assignedNodes({flatten: true}); + return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true}); } else { return [node]; } @@ -73,6 +76,11 @@ } } + /** + * @param {Node} target Node on which to listen for changes. + * @param {Function} callback Function called when there are additions + * or removals from the target's list of flattened nodes. + */ constructor(target, callback) { /** @type {MutationObserver} */ this._shadyChildrenObserver = null; @@ -84,6 +92,7 @@ this._effectiveNodes = []; this._observer = null; this._scheduled = false; + /** @type {function()} */ this._boundSchedule = () => { this._schedule(); } @@ -175,7 +184,7 @@ */ flush() { if (!this._connected) { - return; + return false; } if (window.ShadyDOM) { ShadyDOM.flush(); diff --git a/lib/utils/import-href.html b/lib/utils/import-href.html index 77933a4e43..65e35dfe33 100644 --- a/lib/utils/import-href.html +++ b/lib/utils/import-href.html @@ -45,10 +45,10 @@ * @return {HTMLLinkElement} The link element for the URL to be loaded. */ Polymer.importHref = function(href, onload, onerror, optAsync) { - let link = - document.head.querySelector('link[href="' + href + '"][import-href]'); + let link = /** @type {HTMLLinkElement} */ + (document.head.querySelector('link[href="' + href + '"][import-href]')); if (!link) { - link = document.createElement('link'); + link = /** @type {HTMLLinkElement} */ (document.createElement('link')); link.rel = 'import'; link.href = href; link.setAttribute('import-href', ''); From 37abc4e3f2e3a8c4dc3e146e28239d49169502d2 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 26 Apr 2017 14:08:58 -0700 Subject: [PATCH 02/47] Fix some closure warnings. --- closure.log | 461 +++++++++++++------------------ lib/mixins/property-effects.html | 9 +- lib/utils/templatize.html | 26 ++ 3 files changed, 228 insertions(+), 268 deletions(-) diff --git a/closure.log b/closure.log index 6b8a8c2839..d78d225a39 100644 --- a/closure.log +++ b/closure.log @@ -73,402 +73,422 @@ The found type is a union that includes an unexpected type: null Object.assign(changedProps, inst.__dataPending); ^^^^^^^^^^^^ -/polymer.html_script_10.js:444: WARNING - Property negate never defined on $jscomp$destructuring$var0 of type {event:?} +/polymer.html_script_10.js:396: WARNING - Property __dataLinkedPaths never defined on inst of type Element + let links = inst.__dataLinkedPaths; + ^^^^^^^^^^^^^^^^^^^^^^ + +/polymer.html_script_10.js:403: WARNING - Property _setPendingPropertyOrPath never defined on inst of type Element + inst._setPendingPropertyOrPath(link, value, true, true); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +/polymer.html_script_10.js:406: WARNING - Property _setPendingPropertyOrPath never defined on inst of type Element + inst._setPendingPropertyOrPath(link, value, true, true); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +/polymer.html_script_10.js:437: WARNING - Property negate never defined on $jscomp$destructuring$var0 of type {event:?} let {event, negate} = binding.parts[0]; ^^^^^^ -/polymer.html_script_10.js:470: WARNING - Property target never defined on binding of type {kind:string} +/polymer.html_script_10.js:463: WARNING - Property target never defined on binding of type {kind:string} if (binding.kind === 'attribute' && binding.target[0] === '-') { ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:471: WARNING - Property target never defined on binding of type {kind:string} +/polymer.html_script_10.js:464: WARNING - Property target never defined on binding of type {kind:string} console.warn('Cannot set attribute ' + binding.target + ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:474: WARNING - Property dependencies never defined on part of type Object +/polymer.html_script_10.js:467: WARNING - Property dependencies never defined on part of type Object let dependencies = part.dependencies; ^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:512: WARNING - Property binding never defined on info of type {index:number} +/polymer.html_script_10.js:505: WARNING - Property binding never defined on info of type {index:number} let binding = info.binding; ^^^^^^^^^^^^ -/polymer.html_script_10.js:513: WARNING - Property part never defined on info of type {index:number} +/polymer.html_script_10.js:506: WARNING - Property part never defined on info of type {index:number} let part = info.part; ^^^^^^^^^ -/polymer.html_script_10.js:522: WARNING - Property _enqueueClient never defined on inst of type Element +/polymer.html_script_10.js:515: WARNING - Property _enqueueClient never defined on inst of type Element inst._enqueueClient(node); ^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:525: WARNING - Property evaluator never defined on info of type {index:number} +/polymer.html_script_10.js:518: WARNING - Property evaluator never defined on info of type {index:number} let value = info.evaluator._evaluateBinding(inst, part, path, props, oldProps, hasPaths); ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:545: WARNING - Property sanitizeDOMValue never defined on Polymer of type Polymer<|function({is:string}):HTMLElement|>{prototype:?} +/polymer.html_script_10.js:538: WARNING - Property sanitizeDOMValue never defined on Polymer of type Polymer<|function({is:string}):HTMLElement|>{prototype:?} value = Polymer.sanitizeDOMValue(value, binding.target, binding.kind, node); ^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:545: WARNING - Property kind never defined on binding of type {target:?} +/polymer.html_script_10.js:538: WARNING - Property kind never defined on binding of type {target:?} value = Polymer.sanitizeDOMValue(value, binding.target, binding.kind, node); ^^^^^^^^^^^^ -/polymer.html_script_10.js:549: WARNING - Property target never defined on binding of type {kind:?} +/polymer.html_script_10.js:542: WARNING - Property target never defined on binding of type {kind:?} inst._valueToNodeAttribute(node, value, binding.target); ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:552: WARNING - Property target never defined on binding of type {kind:?} +/polymer.html_script_10.js:545: WARNING - Property target never defined on binding of type {kind:?} let prop = binding.target; ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:582: WARNING - Property kind never defined on binding of type Object +/polymer.html_script_10.js:575: WARNING - Property kind never defined on binding of type Object if (binding.kind !== 'attribute') { ^^^^^^^^^^^^ -/polymer.html_script_10.js:584: WARNING - Property target never defined on binding of type Object +/polymer.html_script_10.js:577: WARNING - Property target never defined on binding of type Object if (binding.target === 'textContent' || ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:585: WARNING - Property target never defined on binding of type Object +/polymer.html_script_10.js:578: WARNING - Property target never defined on binding of type Object (node.localName == 'input' && binding.target == 'value')) { ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:623: WARNING - Property nodeInfoList never defined on $jscomp$destructuring$var1 of type {nodeList:?} +/polymer.html_script_10.js:616: WARNING - Property nodeInfoList never defined on $jscomp$destructuring$var1 of type {nodeList:?} let {nodeList, nodeInfoList} = templateInfo; ^^^^^^^^^^^^ -/polymer.html_script_10.js:710: WARNING - Property methodName never defined on sig of type Object +/polymer.html_script_10.js:703: WARNING - Property methodName never defined on sig of type Object let dynamicFn = sig.static || dynamicFns && dynamicFns[sig.methodName]; ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:712: WARNING - Property methodName never defined on sig of type Object +/polymer.html_script_10.js:705: WARNING - Property methodName never defined on sig of type Object methodName: sig.methodName, ^^^^^^^^^^^^^^ -/polymer.html_script_10.js:713: WARNING - Property args never defined on sig of type Object +/polymer.html_script_10.js:706: WARNING - Property args never defined on sig of type Object args: sig.args, ^^^^^^^^ -/polymer.html_script_10.js:717: WARNING - Property args never defined on sig of type Object +/polymer.html_script_10.js:710: WARNING - Property args never defined on sig of type Object for (let i=0, arg; (i|string +More details: +The found type is a union that includes an unexpected type: Array + computeLinkedPaths(this, path, value); + ^^^^ + +/polymer.html_script_10.js:1364: WARNING - Invalid redeclaration of property _setPendingProperty. +inherited type : function(this:Polymer_PropertyEffects,*,*,*):? +overriding type : function(this:PropertyEffects,string,*,boolean|undefined=):boolean + + _setPendingProperty(property, value, shouldNotify) { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +/polymer.html_script_10.js:1364: WARNING - Missing return statement. Function expected to return boolean. _setPendingProperty(property, value, shouldNotify) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:1529: WARNING - Invalid type for parameter 1 of function runComputedEffects. +/polymer.html_script_10.js:1526: WARNING - Invalid type for parameter 1 of function runComputedEffects. Expected : Element|null Found : PropertyEffects{__dataHasPaths:boolean} runComputedEffects(this, changedProps, oldProps, hasPaths); ^^^^ -/polymer.html_script_10.js:1529: WARNING - Invalid type for parameter 2 of function runComputedEffects. +/polymer.html_script_10.js:1526: WARNING - Invalid type for parameter 2 of function runComputedEffects. Expected : Object|null Found : * runComputedEffects(this, changedProps, oldProps, hasPaths); ^^^^^^^^^^^^ -/polymer.html_script_10.js:1529: WARNING - Invalid type for parameter 3 of function runComputedEffects. +/polymer.html_script_10.js:1526: WARNING - Invalid type for parameter 3 of function runComputedEffects. Expected : Object|null Found : * runComputedEffects(this, changedProps, oldProps, hasPaths); ^^^^^^^^ -/polymer.html_script_10.js:1531: WARNING - Invalid type for parameter 1 of function computeLinkedPaths. -Expected : Element|null -Found : PropertyEffects{__dataHasPaths:boolean} - - computeLinkedPaths(this, changedProps, hasPaths); - ^^^^ - -/polymer.html_script_10.js:1531: WARNING - Invalid type for parameter 2 of function computeLinkedPaths. -Expected : Object|null -Found : * - - computeLinkedPaths(this, changedProps, hasPaths); - ^^^^^^^^^^^^ - -/polymer.html_script_10.js:1537: WARNING - Invalid type for parameter 1 of function this._propagatePropertyChanges. +/polymer.html_script_10.js:1532: WARNING - Invalid type for parameter 1 of function this._propagatePropertyChanges. Expected : Object|null Found : * this._propagatePropertyChanges(changedProps, oldProps, hasPaths); ^^^^^^^^^^^^ -/polymer.html_script_10.js:1537: WARNING - Invalid type for parameter 2 of function this._propagatePropertyChanges. +/polymer.html_script_10.js:1532: WARNING - Invalid type for parameter 2 of function this._propagatePropertyChanges. Expected : Object|null Found : * this._propagatePropertyChanges(changedProps, oldProps, hasPaths); ^^^^^^^^ -/polymer.html_script_10.js:1541: WARNING - Property __reflectEffects never defined on this of type PropertyEffects{__dataHasPaths:boolean, __dataToNotify:null} +/polymer.html_script_10.js:1536: WARNING - Property __reflectEffects never defined on this of type PropertyEffects{__dataHasPaths:boolean, __dataToNotify:null} runEffects(this, this.__reflectEffects, changedProps, oldProps, hasPaths); ^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:1541: WARNING - Invalid type for parameter 3 of function runEffects. +/polymer.html_script_10.js:1536: WARNING - Invalid type for parameter 3 of function runEffects. Expected : Object|null Found : * runEffects(this, this.__reflectEffects, changedProps, oldProps, hasPaths); ^^^^^^^^^^^^ -/polymer.html_script_10.js:1541: WARNING - Invalid type for parameter 4 of function runEffects. +/polymer.html_script_10.js:1536: WARNING - Invalid type for parameter 4 of function runEffects. Expected : Object|null|undefined Found : * runEffects(this, this.__reflectEffects, changedProps, oldProps, hasPaths); ^^^^^^^^ -/polymer.html_script_10.js:1543: WARNING - Property __observeEffects never defined on this of type PropertyEffects{__dataHasPaths:boolean, __dataToNotify:null} +/polymer.html_script_10.js:1538: WARNING - Property __observeEffects never defined on this of type PropertyEffects{__dataHasPaths:boolean, __dataToNotify:null} runEffects(this, this.__observeEffects, changedProps, oldProps, hasPaths); ^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:1543: WARNING - Invalid type for parameter 3 of function runEffects. +/polymer.html_script_10.js:1538: WARNING - Invalid type for parameter 3 of function runEffects. Expected : Object|null Found : * runEffects(this, this.__observeEffects, changedProps, oldProps, hasPaths); ^^^^^^^^^^^^ -/polymer.html_script_10.js:1543: WARNING - Invalid type for parameter 4 of function runEffects. +/polymer.html_script_10.js:1538: WARNING - Invalid type for parameter 4 of function runEffects. Expected : Object|null|undefined Found : * runEffects(this, this.__observeEffects, changedProps, oldProps, hasPaths); ^^^^^^^^ -/polymer.html_script_10.js:1546: WARNING - Invalid type for parameter 1 of function runNotifyEffects. +/polymer.html_script_10.js:1541: WARNING - Invalid type for parameter 1 of function runNotifyEffects. Expected : Element|null Found : PropertyEffects{__dataHasPaths:boolean, __dataToNotify:null} runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths); ^^^^ -/polymer.html_script_10.js:1546: WARNING - Invalid type for parameter 3 of function runNotifyEffects. +/polymer.html_script_10.js:1541: WARNING - Invalid type for parameter 3 of function runNotifyEffects. Expected : Object|null Found : * runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths); ^^^^^^^^^^^^ -/polymer.html_script_10.js:1546: WARNING - Invalid type for parameter 4 of function runNotifyEffects. +/polymer.html_script_10.js:1541: WARNING - Invalid type for parameter 4 of function runNotifyEffects. Expected : Object|null Found : * runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths); ^^^^^^^^ -/polymer.html_script_10.js:1549: WARNING - Property __dataCounter never defined on this of type PropertyEffects{__dataHasPaths:boolean, __dataToNotify:null} +/polymer.html_script_10.js:1544: WARNING - Property __dataCounter never defined on this of type PropertyEffects{__dataHasPaths:boolean, __dataToNotify:null} if (this.__dataCounter == 1) { ^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:1641: WARNING - Invalid type for parameter 1 of function notifySplices. +/polymer.html_script_10.js:1636: WARNING - Invalid type for parameter 1 of function notifySplices. Expected : Element|null Found : PropertyEffects notifySplices(this, array, info.path, splices); ^^^^ -/polymer.html_script_10.js:1641: WARNING - Property path never defined on info of type Object{} +/polymer.html_script_10.js:1636: WARNING - Property path never defined on info of type Object{} notifySplices(this, array, info.path, splices); ^^^^^^^^^ -/polymer.html_script_10.js:1719: WARNING - Invalid type for parameter 1 of function notifySplice. +/polymer.html_script_10.js:1714: WARNING - Invalid type for parameter 1 of function notifySplice. Expected : Element|null Found : PropertyEffects notifySplice(this, array, info.path, len, items.length, []); ^^^^ -/polymer.html_script_10.js:1719: WARNING - Property path never defined on info of type Object{} +/polymer.html_script_10.js:1714: WARNING - Property path never defined on info of type Object{} notifySplice(this, array, info.path, len, items.length, []); ^^^^^^^^^ -/polymer.html_script_10.js:1743: WARNING - Invalid type for parameter 1 of function notifySplice. +/polymer.html_script_10.js:1738: WARNING - Invalid type for parameter 1 of function notifySplice. Expected : Element|null Found : PropertyEffects notifySplice(this, array, info.path, array.length, 0, [ret]); ^^^^ -/polymer.html_script_10.js:1743: WARNING - Property path never defined on info of type Object{} +/polymer.html_script_10.js:1738: WARNING - Property path never defined on info of type Object{} notifySplice(this, array, info.path, array.length, 0, [ret]); ^^^^^^^^^ -/polymer.html_script_10.js:1779: WARNING - Invalid type for parameter 1 of function notifySplice. +/polymer.html_script_10.js:1774: WARNING - Invalid type for parameter 1 of function notifySplice. Expected : Element|null Found : PropertyEffects notifySplice(this, array, info.path, start, items.length, ret); ^^^^ -/polymer.html_script_10.js:1779: WARNING - Property path never defined on info of type Object{} +/polymer.html_script_10.js:1774: WARNING - Property path never defined on info of type Object{} notifySplice(this, array, info.path, start, items.length, ret); ^^^^^^^^^ -/polymer.html_script_10.js:1803: WARNING - Invalid type for parameter 1 of function notifySplice. +/polymer.html_script_10.js:1798: WARNING - Invalid type for parameter 1 of function notifySplice. Expected : Element|null Found : PropertyEffects notifySplice(this, array, info.path, 0, 0, [ret]); ^^^^ -/polymer.html_script_10.js:1803: WARNING - Property path never defined on info of type Object{} +/polymer.html_script_10.js:1798: WARNING - Property path never defined on info of type Object{} notifySplice(this, array, info.path, 0, 0, [ret]); ^^^^^^^^^ -/polymer.html_script_10.js:1827: WARNING - Invalid type for parameter 1 of function notifySplice. +/polymer.html_script_10.js:1822: WARNING - Invalid type for parameter 1 of function notifySplice. Expected : Element|null Found : PropertyEffects notifySplice(this, array, info.path, 0, items.length, []); ^^^^ -/polymer.html_script_10.js:1827: WARNING - Property path never defined on info of type Object{} +/polymer.html_script_10.js:1822: WARNING - Property path never defined on info of type Object{} notifySplice(this, array, info.path, 0, items.length, []); ^^^^^^^^^ -/polymer.html_script_10.js:1851: WARNING - Property path never defined on info of type Object{} +/polymer.html_script_10.js:1846: WARNING - Property path never defined on info of type Object{} propPath = info.path; ^^^^^^^^^ -/polymer.html_script_10.js:1882: WARNING - Dangerous use of the global THIS object +/polymer.html_script_10.js:1877: WARNING - Dangerous use of the global THIS object this._setProperty(property, value); ^^^^ -/polymer.html_script_10.js:2080: WARNING - Property nodeList never defined on dom of type DocumentFragment +/polymer.html_script_10.js:2075: WARNING - Property nodeList never defined on dom of type DocumentFragment templateInfo.nodeList = dom.nodeList; ^^^^^^^^^^^^ -/polymer.html_script_10.js:2093: WARNING - Property propertyEffects never defined on templateInfo of type {childNodes:Array=, nodeList:?, wasPreBound:truthy=} +/polymer.html_script_10.js:2088: WARNING - Property propertyEffects never defined on templateInfo of type {childNodes:Array=, nodeList:?, wasPreBound:truthy=} runEffects(this, templateInfo.propertyEffects, this.__data, null, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2109: WARNING - Property templateInfo never defined on dom of type DocumentFragment +/polymer.html_script_10.js:2104: WARNING - Property templateInfo never defined on dom of type DocumentFragment let templateInfo = dom.templateInfo; ^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2143: WARNING - Property _parseTemplateNode never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|> +/polymer.html_script_10.js:2138: WARNING - Property _parseTemplateNode never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|> let noted = super._parseTemplateNode(node, templateInfo, nodeInfo); ^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2151: WARNING - Function addBinding: called with 6 argument(s). Function requires at least 7 argument(s) and at most 7. +/polymer.html_script_10.js:2146: WARNING - Function addBinding: called with 6 argument(s). Function requires at least 7 argument(s) and at most 7. addBinding(this, templateInfo, nodeInfo, 'text', 'textContent', parts); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2187: WARNING - Property setAttribute never defined on node of type Node +/polymer.html_script_10.js:2182: WARNING - Property setAttribute never defined on node of type Node node.setAttribute(name, literal); ^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2194: WARNING - Property setAttribute never defined on node of type Node +/polymer.html_script_10.js:2189: WARNING - Property setAttribute never defined on node of type Node node.setAttribute(origName, ''); ^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2197: WARNING - Property removeAttribute never defined on node of type Node +/polymer.html_script_10.js:2192: WARNING - Property removeAttribute never defined on node of type Node node.removeAttribute(origName); ^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2208: WARNING - Property _parseTemplateNodeAttribute never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|> +/polymer.html_script_10.js:2203: WARNING - Property _parseTemplateNodeAttribute never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|> return super._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2226: WARNING - Property _parseTemplateNestedTemplate never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|> +/polymer.html_script_10.js:2221: WARNING - Property _parseTemplateNestedTemplate never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|> let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2232: WARNING - Function addBinding: called with 6 argument(s). Function requires at least 7 argument(s) and at most 7. +/polymer.html_script_10.js:2227: WARNING - Function addBinding: called with 6 argument(s). Function requires at least 7 argument(s) and at most 7. addBinding(this, templateInfo, nodeInfo, 'property', '_host_' + source, parts); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2270: WARNING - Missing return statement. Function expected to return Array|null. +/polymer.html_script_10.js:2265: WARNING - Missing return statement. Function expected to return Array|null. static _parseBindings(text, templateInfo) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_10.js:2299: WARNING - Property args never defined on $jscomp$destructuring$var2 of type Object +/polymer.html_script_10.js:2294: WARNING - Property args never defined on $jscomp$destructuring$var2 of type Object let {args, methodName} = signature; ^^^^ -/polymer.html_script_10.js:2299: WARNING - Property methodName never defined on $jscomp$destructuring$var2 of type Object +/polymer.html_script_10.js:2294: WARNING - Property methodName never defined on $jscomp$destructuring$var2 of type Object let {args, methodName} = signature; ^^^^^^^^^^ -/polymer.html_script_10.js:2352: WARNING - Property source never defined on part of type Object +/polymer.html_script_10.js:2347: WARNING - Property source never defined on part of type Object } else if (path != part.source) { ^^^^^^^^^^^ -/polymer.html_script_10.js:2353: WARNING - Property source never defined on part of type Object +/polymer.html_script_10.js:2348: WARNING - Property source never defined on part of type Object value = Polymer.Path.get(inst, part.source); ^^^^^^^^^^^ -/polymer.html_script_10.js:2358: WARNING - Property __data never defined on inst of type HTMLElement +/polymer.html_script_10.js:2353: WARNING - Property __data never defined on inst of type HTMLElement value = inst.__data[path]; ^^^^^^^^^^^ @@ -714,7 +734,7 @@ Found : PolymerElement this.registrations.forEach(this._regLog); ^^^^ -/polymer.html_script_12.js:60: WARNING - Type annotation references non-existent type Polymer.Debouncer. +/polymer.html_script_12.js:81: WARNING - Type annotation references non-existent type Polymer.Debouncer. * @param {Polymer.Debouncer?} debouncer Debouncer object. ^^^^^^^^^^^^^^^^^ @@ -1052,68 +1072,6 @@ https://github.com/google/closure-compiler/wiki/Using-NTI-(new-type-inference)#w class GestureEventListeners extends superClass { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_15.js:91: WARNING - Returned type does not match declared return type. -Expected : HTMLLinkElement|null -Found : Element{__dynamicImportLoaded:truthy=, href:string=, parentNode:Node|null, rel:string=} - - return link; - ^^^^^^^^^^^^ - -/polymer.html_script_18.js:51: WARNING - Dangerous use of the global THIS object - if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1])) - ^^^^ - -/polymer.html_script_18.js:166: WARNING - Dangerous use of the global THIS object - prefixCount = this.sharedPrefix(current, old, minLength); - ^^^^ - -/polymer.html_script_18.js:169: WARNING - Dangerous use of the global THIS object - suffixCount = this.sharedSuffix(current, old, minLength - prefixCount); - ^^^^ - -/polymer.html_script_18.js:188: WARNING - Dangerous use of the global THIS object - let ops = this.spliceOperationsFromEditDistances( - ^^^^ - -/polymer.html_script_18.js:189: WARNING - Dangerous use of the global THIS object - this.calcEditDistances(current, currentStart, currentEnd, - ^^^^ - -/polymer.html_script_18.js:242: WARNING - Dangerous use of the global THIS object - if (!this.equals(current[i], old[i])) - ^^^^ - -/polymer.html_script_18.js:251: WARNING - Dangerous use of the global THIS object - while (count < searchLength && this.equals(current[--index1], old[--index2])) - ^^^^ - -/polymer.html_script_18.js:258: WARNING - Dangerous use of the global THIS object - return this.calcSplices(current, 0, current.length, previous, 0, - ^^^^ - -/polymer.html_script_19.js:36: WARNING - Misplaced function annotation. This JSDoc is not attached to a function node. Are you missing parentheses? - class FlattenedNodesObserver { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_19.js:51: WARNING - Invalid type for parameter 1 of function isSlot. -Expected : {localName:?} (loose) -Found : Node|null -More details: -The found type is a union that includes an unexpected type: null - if (isSlot(node)) { - ^^^^ - -/polymer.html_script_19.js:52: WARNING - Property assignedNodes never defined on node of type Node - return node.assignedNodes({flatten: true}); - ^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_19.js:166: WARNING - Returned type does not match declared return type. -Expected : boolean -Found : undefined - - return; - ^^^^^^^ - /polymer.html_script_21.js:6: WARNING - All constants must be typed. The compiler could not infer the type of constant normalizedMatchesSelector. 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 normalizedMatchesSelector = p.matches || p.matchesSelector || @@ -1431,123 +1389,94 @@ Found : HTMLElement<|function(new:HTMLElement):?|> return mutablePropertyChange(this, property, value, old, this.mutableData); ^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:17: WARNING - All constants must be typed. The compiler could not infer the type of constant DataTemplate. 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 DataTemplate = Polymer.PropertyEffects(HTMLTemplateElementExtension); - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:18: WARNING - All constants must be typed. The compiler could not infer the type of constant MutableDataTemplate. 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 MutableDataTemplate = Polymer.MutableData(DataTemplate); - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:38: WARNING - Property __dataHost never defined on this of type TemplateInstanceBase - this.root = this._stampTemplate(this.__dataHost); - ^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:45: WARNING - Property __templatizeOwner never defined on this of type TemplateInstanceBase{children:Array, root:DocumentFragment} - if (this.__templatizeOwner.__hideTemplateChildren__) { - ^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:50: WARNING - Property __templatizeOptions never defined on this of type TemplateInstanceBase{children:Array, root:DocumentFragment} - let options = this.__templatizeOptions; - ^^^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:62: WARNING - Property __templatizeOptions never defined on this of type TemplateInstanceBase - let options = this.__templatizeOptions; - ^^^^^^^^^^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:66: WARNING - Function this._setPendingProperty: called with 2 argument(s). Function requires at least 3 argument(s) and at most 3. +/polymer.html_script_26.js:80: WARNING - Function this._setPendingProperty: called with 2 argument(s). Function requires at least 3 argument(s) and at most 3. this._setPendingProperty(iprop, props[iprop]); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:70: WARNING - Property __hostProps never defined on this of type TemplateInstanceBase - for (let hprop in this.__hostProps) { - ^^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:71: WARNING - Function this._setPendingProperty: called with 2 argument(s). Function requires at least 3 argument(s) and at most 3. +/polymer.html_script_26.js:85: WARNING - Function this._setPendingProperty: called with 2 argument(s). Function requires at least 3 argument(s) and at most 3. this._setPendingProperty(hprop, this.__dataHost['_host_' + hprop]); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:71: WARNING - Property __dataHost never defined on this of type TemplateInstanceBase - this._setPendingProperty(hprop, this.__dataHost['_host_' + hprop]); - ^^^^^^^^^^^^^^^ - -/polymer.html_script_26.js:86: WARNING - Property __dataHost never defined on this of type TemplateInstanceBase +/polymer.html_script_26.js:100: WARNING - Property _enqueueClient never defined on this.__dataHost of type HTMLTemplateElement this.__dataHost._enqueueClient(this); - ^^^^^^^^^^^^^^^ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:93: WARNING - Property __templatizeOptions never defined on this of type TemplateInstanceBase{_methodHost:truthy} - if (this._methodHost && this.__templatizeOptions.parentModel) { - ^^^^^^^^^^^^^^^^^^^^^^^^ +/polymer.html_script_26.js:110: WARNING - Property _addEventListenerToNode never defined on this._methodHost of type Object + this._methodHost._addEventListenerToNode(node, eventName, (e) => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:103: WARNING - Property __dataHost never defined on this of type TemplateInstanceBase{_methodHost:truthy=} +/polymer.html_script_26.js:117: WARNING - Property __dataHost never defined on this.__dataHost of type HTMLTemplateElement let templateHost = this.__dataHost.__dataHost; - ^^^^^^^^^^^^^^^ + ^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:165: WARNING - Type annotation references non-existent type Polymer.PropertyEffectsInterface. +/polymer.html_script_26.js:179: WARNING - Type annotation references non-existent type Polymer.PropertyEffectsInterface. * @return {Polymer.PropertyEffectsInterface} The parent model of this instance ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:168: WARNING - Property __parentModel never defined on this of type TemplateInstanceBase +/polymer.html_script_26.js:182: WARNING - Property __parentModel never defined on this of type TemplateInstanceBase let model = this.__parentModel; ^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:175: WARNING - Property __dataHost never defined on model of type TemplateInstanceBase +/polymer.html_script_26.js:189: WARNING - Property __dataHost never defined on model.__dataHost of type HTMLTemplateElement model = model.__dataHost.__dataHost; - ^^^^^^^^^^^^^^^^ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:177: WARNING - Cannot add property __parentModel to a struct instance after it is constructed. +/polymer.html_script_26.js:191: WARNING - Cannot add property __parentModel to a struct instance after it is constructed. this.__parentModel = model; ^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:183: WARNING - All constants must be typed. The compiler could not infer the type of constant MutableTemplateInstanceBase. Please use an explicit type annotation. For more information, see: +/polymer.html_script_26.js:203: WARNING - Found two declarations for property __dataHost on type TemplateInstanceBase. + + TemplateInstanceBase.prototype.__dataHost = null; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +/polymer.html_script_26.js:209: WARNING - All constants must be typed. The compiler could not infer the type of constant MutableTemplateInstanceBase. 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 MutableTemplateInstanceBase = Polymer.MutableData(TemplateInstanceBase); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:204: WARNING - Property _bindTemplate never defined on klass.prototype of type klass.prototype +/polymer.html_script_26.js:230: WARNING - Property _bindTemplate never defined on klass.prototype of type klass.prototype klass.prototype._bindTemplate(template); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:222: WARNING - Property _addPropertyEffect never defined on klass.prototype of type $polymer_html_script_26$classdecl$var1.prototype +/polymer.html_script_26.js:248: WARNING - Property _addPropertyEffect never defined on klass.prototype of type $polymer_html_script_26$classdecl$var1.prototype klass.prototype._addPropertyEffect('_host_' + prop, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:223: WARNING - Property PROPERTY_EFFECT_TYPES never defined on klass.prototype of type $polymer_html_script_26$classdecl$var1.prototype +/polymer.html_script_26.js:249: WARNING - Property PROPERTY_EFFECT_TYPES never defined on klass.prototype of type $polymer_html_script_26$classdecl$var1.prototype klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:225: WARNING - Property _createNotifyingProperty never defined on klass.prototype of type $polymer_html_script_26$classdecl$var1.prototype +/polymer.html_script_26.js:251: WARNING - Property _createNotifyingProperty never defined on klass.prototype of type $polymer_html_script_26$classdecl$var1.prototype klass.prototype._createNotifyingProperty('_host_' + prop); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_26.js:391: WARNING - Cannot access property constructor of non-object type *. +/polymer.html_script_26.js:417: WARNING - Cannot access property constructor of non-object type *. let templateInfo = owner.constructor._parseTemplate(template); ^^^^^ -/polymer.html_script_26.js:396: WARNING - Invalid type for parameter 3 of function createTemplatizerClass. +/polymer.html_script_26.js:422: WARNING - Invalid type for parameter 3 of function createTemplatizerClass. Expected : Object Found : * baseClass = createTemplatizerClass(template, templateInfo, options); ^^^^^^^ -/polymer.html_script_26.js:400: WARNING - Invalid type for parameter 3 of function addPropagateEffects. +/polymer.html_script_26.js:426: WARNING - Invalid type for parameter 3 of function addPropagateEffects. Expected : {forwardHostProp:?} (loose) Found : * addPropagateEffects(template, templateInfo, options); ^^^^^^^ -/polymer.html_script_26.js:407: WARNING - Returned type does not match declared return type. +/polymer.html_script_26.js:433: WARNING - Returned type does not match declared return type. Expected : TemplateInstanceBase|null Found : $polymer_html_script_26$classdecl$var2<|function(new:$polymer_html_script_26$classdecl$var2,...?):undefined|>{prototype:$polymer_html_script_26$classdecl$var2.prototype} return klass; ^^^^^^^^^^^^^ -/polymer.html_script_26.js:448: WARNING - The right side in the assignment is not a subtype of the left side. +/polymer.html_script_26.js:474: WARNING - The right side in the assignment is not a subtype of the left side. Expected : HTMLElement|null Found : Node|null More details: @@ -1671,140 +1600,140 @@ The found type is a union that includes an unexpected type: Node this._flushProperties(); ^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:274: WARNING - Property disconnectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype +/polymer.html_script_30.js:276: WARNING - Property disconnectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype super.disconnectedCallback(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:275: WARNING - Cannot add property __isDetached to a struct instance after it is constructed. +/polymer.html_script_30.js:277: WARNING - Cannot add property __isDetached to a struct instance after it is constructed. this.__isDetached = true; ^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:282: WARNING - Property connectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype +/polymer.html_script_30.js:284: WARNING - Property connectedCallback never defined on domRepeatBase.prototype of type domRepeatBase.prototype super.connectedCallback(); ^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:286: WARNING - Property parentNode never defined on this of type DomRepeat{__isDetached:boolean} +/polymer.html_script_30.js:288: WARNING - Property parentNode never defined on this of type DomRepeat{__isDetached:boolean} let parent = this.parentNode; ^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:298: WARNING - Cannot add property template to a struct instance after it is constructed. +/polymer.html_script_30.js:300: 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:298: WARNING - Property querySelector never defined on this of type DomRepeat +/polymer.html_script_30.js:300: WARNING - Property querySelector never defined on this of type DomRepeat let template = this.template = this.querySelector('template'); ^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:302: WARNING - Property querySelector never defined on $jscomp$this of type DomRepeat +/polymer.html_script_30.js:304: WARNING - Property querySelector never defined on $jscomp$this of type DomRepeat if (this.querySelector('template')) { ^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:309: WARNING - Invalid type for parameter 1 of function observer.observe. +/polymer.html_script_30.js:311: 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:314: WARNING - Property as never defined on this of type DomRepeat +/polymer.html_script_30.js:316: WARNING - Property as never defined on this of type DomRepeat instanceProps[this.as] = true; ^^^^^^^ -/polymer.html_script_30.js:315: WARNING - Property indexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:317: WARNING - Property indexAs never defined on this of type DomRepeat instanceProps[this.indexAs] = true; ^^^^^^^^^^^^ -/polymer.html_script_30.js:316: WARNING - Property itemsIndexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:318: WARNING - Property itemsIndexAs never defined on this of type DomRepeat instanceProps[this.itemsIndexAs] = true; ^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:318: WARNING - Property mutableData never defined on this of type DomRepeat +/polymer.html_script_30.js:320: WARNING - Property mutableData never defined on this of type DomRepeat mutableData: this.mutableData, ^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:322: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:324: WARNING - Dangerous use of the global THIS object let i$ = this.__instances; ^^^^ -/polymer.html_script_30.js:328: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:330: WARNING - Dangerous use of the global THIS object if (Polymer.Path.matches(this.as, prop)) { ^^^^ -/polymer.html_script_30.js:329: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:331: WARNING - Dangerous use of the global THIS object let idx = inst[this.itemsIndexAs]; ^^^^ -/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 (prop == this.as) { ^^^^ -/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 this.items[idx] = value; ^^^^ -/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 let path = Polymer.Path.translate(this.as, 'items.' + idx, prop); ^^^^ -/polymer.html_script_30.js:334: WARNING - Dangerous use of the global THIS object +/polymer.html_script_30.js:336: WARNING - Dangerous use of the global THIS object this.notifyPath(path, value); ^^^^ -/polymer.html_script_30.js:348: WARNING - Property __dataHost never defined on this of type DomRepeat +/polymer.html_script_30.js:350: WARNING - Property __dataHost never defined on this of type DomRepeat return this.__dataHost._methodHost || this.__dataHost; ^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:357: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:359: 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:367: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:369: 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:387: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:389: 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:400: WARNING - Property _targetFrameTime never defined on this of type DomRepeat +/polymer.html_script_30.js:402: WARNING - Property _targetFrameTime never defined on this of type DomRepeat let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime); ^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:404: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:406: 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:423: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:425: 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:434: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:436: 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:434: WARNING - Property delay never defined on this of type DomRepeat{__needFullRefresh:boolean, __observePaths:truthy} +/polymer.html_script_30.js:436: 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:448: WARNING - Invalid type for parameter 1 of function Polymer.Async.timeOut.after. +/polymer.html_script_30.js:450: WARNING - Invalid type for parameter 1 of function Polymer.Async.timeOut.after. Expected : number Found : number|undefined More details: @@ -1812,87 +1741,87 @@ 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:463: WARNING - Invalid type for parameter 1 of function this.__debounceRender. +/polymer.html_script_30.js:465: 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:480: WARNING - Property _setRenderedItemCount never defined on this of type DomRepeat{__pool:{length:number} (loose)} +/polymer.html_script_30.js:482: WARNING - Property _setRenderedItemCount never defined on this of type DomRepeat{__pool:{length:number} (loose)} this._setRenderedItemCount(this.__instances.length); ^^^^^^^^^^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:482: WARNING - Property dispatchEvent never defined on this of type DomRepeat{__instances:{length:?} (loose), __pool:{length:number} (loose)} +/polymer.html_script_30.js:484: 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:491: 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: +/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:516: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} +/polymer.html_script_30.js:518: 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:517: WARNING - Property indexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} +/polymer.html_script_30.js:519: 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:518: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} +/polymer.html_script_30.js:520: 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:554: WARNING - Property as never defined on this of type DomRepeat +/polymer.html_script_30.js:556: WARNING - Property as never defined on this of type DomRepeat model[this.as] = item; ^^^^^^^ -/polymer.html_script_30.js:555: WARNING - Property indexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:557: WARNING - Property indexAs never defined on this of type DomRepeat model[this.indexAs] = instIdx; ^^^^^^^^^^^^ -/polymer.html_script_30.js:556: WARNING - Property itemsIndexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:558: WARNING - Property itemsIndexAs never defined on this of type DomRepeat model[this.itemsIndexAs] = itemIdx; ^^^^^^^^^^^^^^^^^ -/polymer.html_script_30.js:565: WARNING - Property as never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/polymer.html_script_30.js:567: 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:566: WARNING - Property indexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/polymer.html_script_30.js:568: 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:567: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/polymer.html_script_30.js:569: 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:574: WARNING - Property parentNode never defined on this of type DomRepeat{__instances:Object, __pool:{pop:LOOSE_TOP_FUNCTION} (loose)} +/polymer.html_script_30.js:576: 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:601: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object} +/polymer.html_script_30.js:603: 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:625: WARNING - Property as never defined on this of type DomRepeat +/polymer.html_script_30.js:627: WARNING - Property as never defined on this of type DomRepeat return instance && instance[this.as]; ^^^^^^^ -/polymer.html_script_30.js:639: WARNING - Property indexAs never defined on this of type DomRepeat +/polymer.html_script_30.js:641: WARNING - Property indexAs never defined on this of type DomRepeat return instance && instance[this.indexAs]; ^^^^^^^^^^^^ -/polymer.html_script_30.js:656: WARNING - Type annotation references non-existent type TemplateInstanceBase. +/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:660: WARNING - Property template never defined on this of type DomRepeat +/polymer.html_script_30.js:662: WARNING - Property template never defined on this of type DomRepeat return Polymer.Templatize.modelForElement(this.template, el); ^^^^^^^^^^^^^ -/polymer.html_script_30.js:665: WARNING - Invalid type for parameter 2 of function customElements.define. +/polymer.html_script_30.js:667: WARNING - Invalid type for parameter 2 of function customElements.define. Expected : function(new:HTMLElement):? Found : DomRepeat<|function(new:DomRepeat):undefined|> @@ -2276,4 +2205,4 @@ externs/closure-types.js:743: WARNING - property toggle on interface Polymer_Arr Polymer_ArraySelectorMixin.prototype.toggle; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -0 error(s), 498 warning(s), 70.9% typed +0 error(s), 482 warning(s), 71.2% typed diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 5be94f0c8f..0e194999da 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -1303,13 +1303,13 @@ } } this.__dataHasPaths = true; - if (this._setPendingProperty(path, value, shouldNotify)) { + if (this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify)) { computeLinkedPaths(this, path, value); return true; } } else { if (this.__dataHasAccessor && this.__dataHasAccessor[path]) { - return this._setPendingProperty(path, value, shouldNotify); + return this._setPendingProperty(/**@type{string}*/(path), value, shouldNotify); } else { this[path] = value; } @@ -1375,6 +1375,11 @@ * user code); we could introduce a "fixup" for temporarily cached array * paths if needed: https://github.com/Polymer/polymer/issues/4227 * + * @param {string} property Name of the property + * @param {*} value Value to set + * @param {boolean=} shouldNotify True if property should fire notification + * event (applies only for `notify: true` properties) + * @return {boolean} Returns true if the property changed * @override */ _setPendingProperty(property, value, shouldNotify) { diff --git a/lib/utils/templatize.html b/lib/utils/templatize.html index 456c01510f..0d78e1c3a6 100644 --- a/lib/utils/templatize.html +++ b/lib/utils/templatize.html @@ -21,6 +21,10 @@ // class only because Babel (incorrectly) requires super() in the class // constructor even though no `this` is used and it returns an instance. let newInstance = null; + /** + * @constructor + * @extends {HTMLTemplateElement} + */ function HTMLTemplateElementExtension() { return newInstance; } HTMLTemplateElementExtension.prototype = Object.create(HTMLTemplateElement.prototype, { constructor: { @@ -28,7 +32,17 @@ writable: true } }); + /** + * @constructor + * @implements {Polymer_PropertyEffects} + * @extends {HTMLTemplateElementExtension} + */ const DataTemplate = Polymer.PropertyEffects(HTMLTemplateElementExtension); + /** + * @constructor + * @implements {Polymer_MutableData} + * @extends {DataTemplate} + */ const MutableDataTemplate = Polymer.MutableData(DataTemplate); // Applies a DataTemplate subclass to a