|
|
|
|
|
by beremaki
462 days ago
|
|
> You could fix it by eg. `$state(undefined as unknown as HTMLElement)` but that's dumb I think the generic is what you are looking for class Wrapper {
dom = $state<HTMLElement>();
constructor(el: HTMLElement) {
this.dom = el;
}
}
the dom property will still be HTMLElement | undefined, if the 'undefined' bothers you have to add an exclamation mark and write "$state<HTMLElement>()!" |
|