Polymer / polymer

Our original Web Component library.
https://polymer-library.polymer-project.org/
BSD 3-Clause "New" or "Revised" License
22.05k stars 2.02k forks source link

Work around Closure Compiler bug to avoid upcoming type error #5589

Closed lauraharker closed 4 years ago

lauraharker commented 4 years ago

Fixing a compiler type equality bug uncovers a new error caused by https://github.com/google/closure-compiler/issues/2928.

third_party/javascript/polymer/v2/polymer/lib/utils/templatize.js:409: ERROR - [JSC_TYPE_MISMATCH] mismatch in declaration of superclass type found : templatizedBase required: templatizedBase class TemplatizedTemplateExtension extends templatizedBase {}; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(The found and required types are actually different classes completely, as the compiler is attaching the wrong type to TemplatizedTemplateExtension).

lauraharker commented 4 years ago

@rictic

This mirrors the Google-internal http://cl/268099757

kevinpschaaf commented 4 years ago

Noting that gen-typescript-declarations failed on CI:


lib/utils/templatize.d.ts:95:43 - error TS2552: Cannot find name 'templatizedBase'. Did you mean 'templatizerBase'?
95 declare class TemplatizedTemplate extends templatizedBase {
                                             ~~~~~~~~~~~~~~~
  lib/utils/templatize.d.ts:89:15
    89 declare class templatizerBase extends TemplateInstanceBase {
                     ~~~~~~~~~~~~~~~
    'templatizerBase' is declared here.
lib/utils/templatize.d.ts:101:52 - error TS2552: Cannot find name 'templatizedBase'. Did you mean 'templatizerBase'?
101 declare class TemplatizedTemplateExtension extends templatizedBase {
                                                       ~~~~~~~~~~~~~~~
  lib/utils/templatize.d.ts:89:15
    89 declare class templatizerBase extends TemplateInstanceBase {
                     ~~~~~~~~~~~~~~~
    'templatizerBase' is declared here.
kevinpschaaf commented 4 years ago

Thanks for the PR!