enhance-dev / enhance-dev/enhance-starter-typescript
Type errors in Components
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
When I try to make a component, I get some type errors that make it look like TS doesn't understand that CustomElement extends HTMLElement. For example in this code:
```
/* globals customElements */
import CustomElement from "@enhance/custom-element";
export default class TestComponent extends CustomElement {
constructor() {
super();
}
connectedCallback() {
this.addEventListener("change", () => {});
}
render({ html }) {
return html`
`;
}
}
customElements.define("my-component", TestComponent);
```
I get an error on `addEventListener` and on `TestComponent` inside `customElements.define`
Errors are
`Property 'addEventListener' does not exist on type 'TestComponent'.`
```
Argument of type 'typeof TestComponent' is not assignable to parameter of type 'CustomElementConstructor'.
Type 'TestComponent' is missing the following properties from type 'HTMLElement': accessKey, accessKeyLabel, autocapitalize, dir, and 302 more.
```
Contributor guide
Assessment
This issue has not been assessed yet.