Lit 2.0 customElements.define() throws ts(2345)

Solution 1:

Instead of calling the define function, you can use the decorator version when using typescript.

import { html, css, LitElement } from 'lit';
import {customElement} from 'lit/decorators.js';

@customElement('my-component')
export default class MyComponent extends LitElement {...}

customElement - Class decorator factory that defines the decorated class as a custom element.