News for hackers. Stuff that matters.
Re:TypeScript 5.0 by nicoburns on Thursday March 16, 2023 @02:40PM (#35186369)
In fairness, rust-in-wasm has pretty complete DOM bindings. You can quite easily write DOM manipulation code in Rust without ever touching JS/TS. Whether that's a good idea is another matter.
Re:TypeScript 5.0 by maxloh on Thursday March 16, 2023 @03:42PM (#35187268)
How does that work?
Re:TypeScript 5.0 by amaranth on Thursday March 16, 2023 @04:59PM (#35188526)
web-sys[1] generates the binding code using the same IDL files that browsers use to generate their JS bindings to the C++ doing the actual work.

[1] https://github.com/rustwasm/wasm-bindgen/tree/main/crates/we...

Re:TypeScript 5.0 by maxloh on Friday March 17, 2023 @01:46PM (#35200353)
You still need to run JavaScript functions to manipulate the DOM. "without ever touching JS/TS" seems misleading as that implies "no JavaScript code is executed".
Re:TypeScript 5.0 by nicoburns on Friday March 17, 2023 @09:12PM (#35205016)
When I read "touched" I don't think "executed". I think "edited". There is C code executed when I run JavaScript, but that doesn't mean that I had to touch it. Similarly, all the JS run when accessing the DOM from Rust is generated by the library. The user of the library doesn't have to touch it.