Improve types for the template field on Polymer elements. (#5596)

null is allowed!
This commit is contained in:
Peter Burns
2019-10-14 19:57:51 -07:00
committed by GitHub
parent f6ccc9d1bd
commit 4274bcecaa
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -41,7 +41,7 @@ PolymerInit.prototype.extends;
PolymerInit.prototype.properties;
/** @type {(!Array<string> | undefined)} */
PolymerInit.prototype.observers;
/** @type {(!HTMLTemplateElement | string | undefined)} */
/** @type {(!HTMLTemplateElement | string | undefined | null)} */
PolymerInit.prototype.template;
/** @type {(!Object<string, *> | undefined)} */
PolymerInit.prototype.hostAttributes;
@@ -60,7 +60,7 @@ PolymerElementConstructor.extends;
PolymerElementConstructor.properties;
/** @type {(!Array<string> | undefined)} */
PolymerElementConstructor.observers;
/** @type {(!HTMLTemplateElement | string | undefined)} */
/** @type {(!HTMLTemplateElement | string | undefined | null)} */
PolymerElementConstructor.template;
/** @interface */
@@ -150,7 +150,7 @@ var PolymerElement = function() {};
PolymerElement.is;
/**
* The template to stamp when creating this element type.
* @type {!HTMLTemplateElement|undefined}
* @type {!HTMLTemplateElement|undefined|null}
*/
PolymerElement.template;
/**
+1 -1
View File
@@ -115,7 +115,7 @@ export class DomBind extends domBindBase {
render() {
let template;
if (!this.__children) {
template = /** @type {HTMLTemplateElement} */(template || this.querySelector('template'));
template = /** @type {?HTMLTemplateElement} */(template || this.querySelector('template'));
if (!template) {
// Wait until childList changes and template should be there by then
let observer = new MutationObserver(() => {