Skip to content

Commit 4274bce

Browse files
authored
Improve types for the template field on Polymer elements. (#5596)
null is allowed!
1 parent f6ccc9d commit 4274bce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

externs/polymer-externs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ PolymerInit.prototype.extends;
4141
PolymerInit.prototype.properties;
4242
/** @type {(!Array<string> | undefined)} */
4343
PolymerInit.prototype.observers;
44-
/** @type {(!HTMLTemplateElement | string | undefined)} */
44+
/** @type {(!HTMLTemplateElement | string | undefined | null)} */
4545
PolymerInit.prototype.template;
4646
/** @type {(!Object<string, *> | undefined)} */
4747
PolymerInit.prototype.hostAttributes;
@@ -60,7 +60,7 @@ PolymerElementConstructor.extends;
6060
PolymerElementConstructor.properties;
6161
/** @type {(!Array<string> | undefined)} */
6262
PolymerElementConstructor.observers;
63-
/** @type {(!HTMLTemplateElement | string | undefined)} */
63+
/** @type {(!HTMLTemplateElement | string | undefined | null)} */
6464
PolymerElementConstructor.template;
6565

6666
/** @interface */
@@ -150,7 +150,7 @@ var PolymerElement = function() {};
150150
PolymerElement.is;
151151
/**
152152
* The template to stamp when creating this element type.
153-
* @type {!HTMLTemplateElement|undefined}
153+
* @type {!HTMLTemplateElement|undefined|null}
154154
*/
155155
PolymerElement.template;
156156
/**

lib/elements/dom-bind.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class DomBind extends domBindBase {
115115
render() {
116116
let template;
117117
if (!this.__children) {
118-
template = /** @type {HTMLTemplateElement} */(template || this.querySelector('template'));
118+
template = /** @type {?HTMLTemplateElement} */(template || this.querySelector('template'));
119119
if (!template) {
120120
// Wait until childList changes and template should be there by then
121121
let observer = new MutationObserver(() => {

0 commit comments

Comments
 (0)