Closed dmitriiKovchin closed 9 years ago
So Text is subtype of Element
No Text and Element are subtype of Node.
tern-lint is able to support heritage. This error is normal because the browser.json has an error. Node#appendChild waits an Element and not a Node although it should be wait a Node.
I have created a PR for that https://github.com/marijnh/tern/pull/665 which fix your error.
Thanks!
I close this issue. tern has accepted my PR. See https://github.com/marijnh/tern/pull/665
We have type definition for appendChild function from https://github.com/marijnh/tern/blob/master/defs/browser.json:
"appendChild": { "!type": "fn(newElt: +Element) -> +Element", "!url": "https://developer.mozilla.org/en/docs/DOM/Node.appendChild", "!doc": "Adds a node to the end of the list of children of a specified parent node. If the node already exists it is removed from current parent node, then added to new parent node." },
Text.prototype = Node Node.prototype = Element So Text is subtype of Element. In parameter validation should we check that actual parameter is subtype of expected type rather than exact expected type?