open-wc / custom-elements-manifest

Custom Elements Manifest is a file format that describes custom elements in your project.
https://custom-elements-manifest.open-wc.org/
227 stars 37 forks source link

JSDoc comments from mixin class ignored #150

Open WickyNilliams opened 2 years ago

WickyNilliams commented 2 years ago

Checklist

Completing the items above will greatly improve triaging time of your issue.

Expected behavior

This was already discussed on slack previously, so adding here as a reminder, and for visibility. Here is a minimal reproduction

In brief, given a mixin like this:

export function SlotMixin(superClass) {
  /**
   * @slot foo - i was hoping CEM would pick up on this, so i could document the slot just once, on the mixin.
   */
  class SlotElement extends superClass {
    renderSomeSlot() {
      return html`<slot name="foo"></slot>`;
    }
  }

  return SlotElement;
}

And a component like this:

@customElement("my-element")
export class MyElement extends SlotMixin(LitElement) {
  render() {
    return html`<div>${this.renderSomeSlot()}</div>`;
  }
}

I would hope that CEM would pick up the jsdoc comments and apply it to MyElement, but this is not the case.

Here are some pointers that were linked to on slack: