Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several warnings when using incremental-dom-closure.js with Closure Compiler #342

Open
morisil opened this issue Jun 6, 2017 · 1 comment

Comments

@morisil
Copy link

morisil commented Jun 6, 2017

I built the incremental-dom using js-closure target and it works well. But when I compile my application with the Closure Compiler I get the following output:

js/lib/incemental-dom/incremental-dom-closure.js:70: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor
           ^

js/lib/incemental-dom/incremental-dom-closure.js:111: WARNING - Bad type annotation. Unknown type NameOrCtorDef
   * @const {NameOrCtorDef}
             ^

js/lib/incemental-dom/incremental-dom-closure.js:130: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The nodeName or constructor for the Node.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:213: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The tag or constructor for the Element.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:345: WARNING - Bad type annotation. Unknown type NameOrCtorDef
  * @param {NameOrCtorDef} currentNameOrCtor
            ^

js/lib/incemental-dom/incremental-dom-closure.js:346: WARNING - Bad type annotation. Unknown type NameOrCtorDef
  * @param {NameOrCtorDef} nameOrCtor
            ^

js/lib/incemental-dom/incremental-dom-closure.js:592: WARNING - assignment to property patch of module$exports$incrementaldom
found   : function ((DocumentFragment|Element), function (?): ?, ?=): (Node|null)
required: function ((DocumentFragment|Element), function (T): ?, T=): Node
var patchInner = patchFactory(function (node, fn, data) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:618: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
  var startNode = /** @type {!Element} */{ nextSibling: node };
                                         ^^^^^^^^^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:628: WARNING - assignment
found   : {nextSibling: (DocumentFragment|Element)}
required: (Node|null)
  currentNode = startNode;
  ^^^^^^^^^^^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:632: WARNING - actual parameter 1 of module$contents$incrementaldom_assertPatchElementNoExtras does not match formal parameter
found   : {nextSibling: (DocumentFragment|Element)}
required: (Node|null)
    assertPatchElementNoExtras(startNode, currentNode, expectedNextNode, expectedPrevNode);
                               ^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:632: WARNING - actual parameter 2 of module$contents$incrementaldom_assertPatchElementNoExtras does not match formal parameter
found   : {nextSibling: (DocumentFragment|Element)}
required: (Node|null)
    assertPatchElementNoExtras(startNode, currentNode, expectedNextNode, expectedPrevNode);
                                          ^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:639: WARNING - inconsistent return type
found   : (null|{nextSibling: (DocumentFragment|Element)})
required: (Node|null)
  return startNode === currentNode ? null : currentNode;
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:647: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The name or constructor to check for.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:665: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The name or constructor for the Node.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:781: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The tag or constructor for the Element.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:793: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
  return (/** @type {!Element} */currentParent
                                 ^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:793: WARNING - inconsistent return type
found   : (Node|null)
required: Element
  return (/** @type {!Element} */currentParent
                                 ^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:809: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
  return (/** @type {!Element} */currentNode
                                 ^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:809: WARNING - inconsistent return type
found   : (Node|null)
required: Element
  return (/** @type {!Element} */currentNode
                                 ^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:822: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
  return (/** @type {!Text} */currentNode
                              ^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:822: WARNING - inconsistent return type
found   : (Node|null)
required: Text
  return (/** @type {!Text} */currentNode
                              ^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:835: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
  return (/** @type {!Element} */currentParent
                                 ^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:835: WARNING - inconsistent return type
found   : (Node|null)
required: Element
  return (/** @type {!Element} */currentParent
                                 ^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:963: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
    var obj = /** @type {!Object<string,string>} */style;
                                                   ^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:966: WARNING - actual parameter 1 of module$contents$incrementaldom_has does not match formal parameter
found   : *
required: Object<string,*>
      if (has(obj, prop)) {
              ^^^

js/lib/incemental-dom/incremental-dom-closure.js:987: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
    applyAttr(el, name, /** @type {?(boolean|number|string)} */value);
                                                               ^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:987: WARNING - actual parameter 3 of module$exports$incrementaldom.applyAttr does not match formal parameter
found   : *
required: (boolean|null|number|string|undefined)
    applyAttr(el, name, /** @type {?(boolean|number|string)} */value);
                                                               ^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:1036: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:1059: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
        var name = /** @type {string} */statics[_i];
                                        ^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:1061: WARNING - actual parameter 2 of module$contents$incrementaldom_updateAttribute does not match formal parameter
found   : *
required: string
        updateAttribute(node, name, value);
                              ^^^^

js/lib/incemental-dom/incremental-dom-closure.js:1144: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:1197: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:1217: WARNING - Bad type annotation. Unknown type NameOrCtorDef
 * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor.
           ^

js/lib/incemental-dom/incremental-dom-closure.js:1252: WARNING - assignment to property text of NodeData
found   : (boolean|number|string)
required: (null|string)
    data.text = /** @type {string} */value;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

js/lib/incemental-dom/incremental-dom-closure.js:1252: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?
    data.text = /** @type {string} */value;
                                     ^^^^^

0 error(s), 35 warning(s), 97.3% typed

I cannot tell how severe problems these warnings indicate. But maybe it will be helpful to have them collected in this ticket.

@morisil
Copy link
Author

morisil commented Jul 18, 2017

I upgraded to closure compiler v20170626 and now the output seems to be a bit more informative

Originally at:
js/lib/incemental-dom/src/node_data.js:21: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:111: 
Originally at:
js/lib/incemental-dom/src/node_data.js:60: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:130: 
Originally at:
js/lib/incemental-dom/src/node_data.js:76: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:213: 
Originally at:
js/lib/incemental-dom/src/nodes.js:30: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:345: 
Originally at:
js/lib/incemental-dom/src/assertions.js:120: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:346: 
Originally at:
js/lib/incemental-dom/src/assertions.js:120: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:592: 
Originally at:
js/lib/incemental-dom/src/core.js:125: WARNING - assignment to property patch of module$exports$incrementaldom
found   : function ((DocumentFragment|Element), function (?): ?, ?=): (Node|null)
required: function ((DocumentFragment|Element), function (T): ?, T=): Node

js/lib/incemental-dom/incremental-dom-closure.js:618: 
Originally at:
js/lib/incemental-dom/src/core.js:152: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:628: 
Originally at:
js/lib/incemental-dom/src/core.js:159: WARNING - assignment
found   : {nextSibling: (DocumentFragment|Element)}
required: (Node|null)

js/lib/incemental-dom/incremental-dom-closure.js:632: 
Originally at:
js/lib/incemental-dom/src/core.js:166: WARNING - actual parameter 1 of module$contents$incrementaldom_assertPatchElementNoExtras does not match formal parameter
found   : {nextSibling: (DocumentFragment|Element)}
required: (Node|null)

js/lib/incemental-dom/incremental-dom-closure.js:632: 
Originally at:
js/lib/incemental-dom/src/core.js:166: WARNING - actual parameter 2 of module$contents$incrementaldom_assertPatchElementNoExtras does not match formal parameter
found   : {nextSibling: (DocumentFragment|Element)}
required: (Node|null)

js/lib/incemental-dom/incremental-dom-closure.js:639: 
Originally at:
js/lib/incemental-dom/src/core.js:174: WARNING - inconsistent return type
found   : (null|{nextSibling: (DocumentFragment|Element)})
required: (Node|null)

js/lib/incemental-dom/incremental-dom-closure.js:647: 
Originally at:
js/lib/incemental-dom/src/core.js:151: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:665: 
Originally at:
js/lib/incemental-dom/src/core.js:189: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:781: 
Originally at:
js/lib/incemental-dom/src/core.js:314: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:793: 
Originally at:
js/lib/incemental-dom/src/core.js:338: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:793: 
Originally at:
js/lib/incemental-dom/src/core.js:338: WARNING - inconsistent return type
found   : (Node|null)
required: Element

js/lib/incemental-dom/incremental-dom-closure.js:809: 
Originally at:
js/lib/incemental-dom/src/core.js:354: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:809: 
Originally at:
js/lib/incemental-dom/src/core.js:354: WARNING - inconsistent return type
found   : (Node|null)
required: Element

js/lib/incemental-dom/incremental-dom-closure.js:822: 
Originally at:
js/lib/incemental-dom/src/core.js:367: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:822: 
Originally at:
js/lib/incemental-dom/src/core.js:367: WARNING - inconsistent return type
found   : (Node|null)
required: Text

js/lib/incemental-dom/incremental-dom-closure.js:835: 
Originally at:
js/lib/incemental-dom/src/core.js:380: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:835: 
Originally at:
js/lib/incemental-dom/src/core.js:380: WARNING - inconsistent return type
found   : (Node|null)
required: Element

js/lib/incemental-dom/incremental-dom-closure.js:963: 
Originally at:
js/lib/incemental-dom/src/attributes.js:101: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:966: 
Originally at:
js/lib/incemental-dom/src/attributes.js:104: WARNING - actual parameter 1 of module$contents$incrementaldom_has does not match formal parameter
found   : *
required: Object<string,*>

js/lib/incemental-dom/incremental-dom-closure.js:987: 
Originally at:
js/lib/incemental-dom/src/attributes.js:126: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:987: 
Originally at:
js/lib/incemental-dom/src/attributes.js:126: WARNING - actual parameter 3 of module$exports$incrementaldom.applyAttr does not match formal parameter
found   : *
required: (boolean|null|number|string|undefined)

js/lib/incemental-dom/incremental-dom-closure.js:1036: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:60: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:1059: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:87: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

js/lib/incemental-dom/incremental-dom-closure.js:1061: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:89: WARNING - actual parameter 2 of module$contents$incrementaldom_updateAttribute does not match formal parameter
found   : *
required: string

js/lib/incemental-dom/incremental-dom-closure.js:1144: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:75: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:1197: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:214: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:1217: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:232: WARNING - Bad type annotation. Unknown type NameOrCtorDef

js/lib/incemental-dom/incremental-dom-closure.js:1252: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:285: WARNING - assignment to property text of NodeData
found   : (boolean|number|string)
required: (null|string)

js/lib/incemental-dom/incremental-dom-closure.js:1252: 
Originally at:
js/lib/incemental-dom/src/virtual_elements.js:286: WARNING - Misplaced type annotation. Type annotations are not allowed here. Are you missing parentheses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant