There’s Typescript, it’s as close as you can get.
Comment on What's stopping WebAssembly from effectively replacing JavaScript?
livingcoder@programming.dev 10 months ago
From my experience JS is primarily used to manipulate the DOM. I haven’t looked into it, but if you’re correct that WASM cannot manipulate the DOM then your question, to me, is tantamount to “Why aren’t people using forks to eat soup?”. I would love a staticly-typed, compiled language to come along and replace JS. If anyone is aware of how I can write Rust in place of JS, please let me know. For now, I suffer/enjoy JS.
Blamemeta@lemm.ee 10 months ago
icesentry@lemmy.ca 10 months ago
You can absolutely modify the dom, you just need to go through a thin js glue layer between the dom and wasm
dneaves@lemmy.world 10 months ago
For transpiled-to-JS languages: Elm, Purescript, Typescript
I personally use Elm. Really helps remove all the JS funny business, without really having to type it (mostly)
nous@programming.dev 10 months ago
There are quite a few web frontend frameworks for rust now that are reasonably mature. Though you might still find a few rough edges they are usable for projects now. www.leptos.dev dioxuslabs.com yew.rs All of these can work without you needing to write any JS code. Though there is JS glue code involved, it is generated and you don’t need to worry about it.
But the JS eco system is still quite large and hard to completely avoid.