Skip to content

Commit 5382e2c

Browse files
committed
Work around Closure Compiler bug to avoid upcoming type error
Fixing a compiler type-equality bug uncovers a new error caused by google/closure-compiler#2928.
1 parent 27779a3 commit 5382e2c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

lib/utils/templatize.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,21 +392,31 @@ function addPropagateEffects(target, templateInfo, options, methodHost) {
392392
* @constructor
393393
* @extends {DataTemplate}
394394
*/
395-
let templatizedBase = options.mutableData ? MutableDataTemplate : DataTemplate;
395+
let templatizedBase =
396+
options.mutableData ? MutableDataTemplate : DataTemplate;
397+
398+
// NOTE: due to https://github.com/google/closure-compiler/issues/2928,
399+
// combining the next two lines into one assignment causes a spurious
400+
// type error.
401+
class TemplatizedTemplate extends templatizedBase {}
396402
/** @private */
397-
klass = templateInfo.templatizeTemplateClass =
398-
class TemplatizedTemplate extends templatizedBase {};
403+
klass = templateInfo.templatizeTemplateClass = TemplatizedTemplate;
399404
} else {
400405
/**
401406
* @constructor
402407
* @extends {PolymerElement}
403408
*/
404409
const templatizedBase = target.constructor;
410+
405411
// Create a cached subclass of the base custom element class onto which
406412
// to put the template-specific propagate effects
413+
// NOTE: due to https://github.com/google/closure-compiler/issues/2928,
414+
// combining the next two lines into one assignment causes a spurious
415+
// type error.
416+
class TemplatizedTemplateExtension extends templatizedBase {}
407417
/** @private */
408418
klass = templateInfo.templatizeTemplateClass =
409-
class TemplatizedTemplateExtension extends templatizedBase {};
419+
TemplatizedTemplateExtension;
410420
}
411421
// Add template - >instances effects
412422
// and host <- template effects

0 commit comments

Comments
 (0)