class Wrapper {
dom: HTMLElement = $state()
constructor(el: HTMLElement) {
this.dom = el
}
}
as TypeScript throws an error about `Type 'undefined' is not assignable to type 'HTMLElement' for the $state()`. You could fix it by eg. `$state(undefined as unknown as HTMLElement)` but that's dumb. Interesting enough you could do something like: class Wrapper {
dom: HTMLElement
constructor(el: HTMLElement) {
let d = $state(el)
this.dom = d
}
}
Moreover, Vite/esbuild mangles class-field parameters with esnext into constructor-set parameters as they are just more versatile. So the original code becomes something like: class Wrapper {
constructor(el: HTMLElement) {
this.dom = $state(el)
}
}
Which is incompatible with rules of runes. I did whine about this already https://github.com/sveltejs/svelte/issues/14600 but so far no clear answer Location: Helsinki
Remote: Yes
Willing to relocate: No
Technologies: JS/TS, HTML/CSS, NodeJS, Svelte, React, Vue, ProseMirror, Tailwind, AWS, Terraform, Postgres
Résumé/CV: https://teemukoivisto.xyz/cv
Email: [email protected]
I'm a full-stack dev of 6 years who is interested working on some Svelte or rich-text related project or anything else in the realm of TS with some infra or databases sprinkled on top. Location: Helsinki
Remote: Yes
Willing to relocate: No
Technologies: Rust, TS/JS, NodeJS, Svelte, React, Terraform, Ansible, ProseMirror, HTML/CSS, Tailwind
Résumé/CV: https://teemukoivisto.xyz/cv
Email: [email protected]
I have 6 years of work experience with webdev and rich-text but I've come interested in learning Rust. During the past 1.5 years I've taught myself the basics and programmed a game engine (with a friend) in Rust with multiplayer (Rapier, tokio, axum, Flutter) as well as websocket server for collaborative editing.