runem / lit-analyzer

Monorepository for tools that analyze lit-html templates
MIT License
318 stars 36 forks source link

cannot extend HTMLElementTagNameMap with computed value #261

Open jobalcaen opened 2 years ago

jobalcaen commented 2 years ago

If I try to extend the HTMLElementTagNameMap interface with a computed value for the tag name, lit-plugin won't find my element. Is there a workaround for this, apart from using a string directly?

declare global {
  interface HTMLElementTagNameMap {
    [MyElement.tagName]: MyElement;
  }
}
maheshwari-ashutosh commented 2 years ago

I am facing this same Issue and the below error The tag name 'TAG_NAME' is not a valid custom element name. Remember that a hyphen (-) is required.lit-plugin(no-invalid-tag-name)(2309)

declare global {
  interface HTMLElementTagNameMap {
    [Component.TAG_NAME]: Component;
  }
}