Skip to content

[bug]: TypeScript .d.ts files don't output class methods #31

Description

@ajguyot

Describe the bug

Given the following component code:

/**
 * The description of the component goes here.
 *
 * @displayName my-element
 * @status alpha
 *
 */
export default class MyElement extends Elena(HTMLElement) {
  static tagName = "my-element";

  myMethod() {
    console.log('cool', this.element);
  }
}
MyElement.define();

The generated .d.ts file looks like this:

export type { MyElementProps } from './custom-elements.js';

declare class MyElement extends HTMLElement {
  /** The text content of the element, captured from light DOM before the first render. */
  text?: string;
}

export default MyElement;

My expectation/need would be for the class file to include the myMethod() method in the typing so that I can get autocomplete throughout the rest of my code. Elena seems to suppress method types even if I explicitly include them in JSDoc tags.

Affected area

CEM TypeScript plugin

How to reproduce

See above.

Configuration file (if applicable)

No response

Codepen link

No response

Logs

System Info

Node 24

Before submitting

  • I’ve searched for existing issues
  • I’ve checked the documentation
  • I’ve tried the latest version of Elena

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions