When extending a lit-element Class to add more specific typing, should the @property
decorator be overridden or just the type and initializer? For example, consider the following code:
interface AB {
a: number,
b: string,
}
@customElement('my-parent')
class MyParent extends LitElement {
@property({type: Array}) stuff: readonly any[] = [];
}
which of the following approaches is the correct way to subclass:
@customElement('my-child')
class MyChild extends MyParent {
override @property({type: Array}) stuff: readonly Readonly<AB>[] = [];
}
or
@customElement('my-child')
class MyChild extends MyParent {
override stuff: readonly Readonly<AB>[] = [];
}
Both are currently functioning in my project, so I am unsure which one to use as the standard.