Skip to content

Commit

Permalink
Work around Closure Compiler bug to avoid upcoming type error
Browse files Browse the repository at this point in the history
Fixing a compiler type-equality bug uncovers a new error caused by
google/closure-compiler#2928.
  • Loading branch information
lauraharker committed Sep 9, 2019
1 parent 27779a3 commit 5382e2c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/utils/templatize.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,21 +392,31 @@ function addPropagateEffects(target, templateInfo, options, methodHost) {
* @constructor
* @extends {DataTemplate}
*/
let templatizedBase = options.mutableData ? MutableDataTemplate : DataTemplate;
let templatizedBase =
options.mutableData ? MutableDataTemplate : DataTemplate;

// NOTE: due to https://github.com/google/closure-compiler/issues/2928,
// combining the next two lines into one assignment causes a spurious
// type error.
class TemplatizedTemplate extends templatizedBase {}
/** @private */
klass = templateInfo.templatizeTemplateClass =
class TemplatizedTemplate extends templatizedBase {};
klass = templateInfo.templatizeTemplateClass = TemplatizedTemplate;
} else {
/**
* @constructor
* @extends {PolymerElement}
*/
const templatizedBase = target.constructor;

// Create a cached subclass of the base custom element class onto which
// to put the template-specific propagate effects
// NOTE: due to https://github.com/google/closure-compiler/issues/2928,
// combining the next two lines into one assignment causes a spurious
// type error.
class TemplatizedTemplateExtension extends templatizedBase {}
/** @private */
klass = templateInfo.templatizeTemplateClass =
class TemplatizedTemplateExtension extends templatizedBase {};
TemplatizedTemplateExtension;
}
// Add template - >instances effects
// and host <- template effects
Expand Down

0 comments on commit 5382e2c

Please sign in to comment.