Skip to content

Commit

Permalink
Improve types for the template field on Polymer elements. (#5596)
Browse files Browse the repository at this point in the history
null is allowed!
  • Loading branch information
rictic committed Oct 15, 2019
1 parent f6ccc9d commit 4274bce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions externs/polymer-externs.js
Expand Up @@ -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;
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/elements/dom-bind.js
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 4274bce

Please sign in to comment.