For non-realtime WebApps (i.e. GC pause okay), anyone find TypeScript more productive than Rust ?
For me, the reasons have been:
- IntelliJ TypeScript offering better auto completion than IntelliJ Rust / web_sys for the DOM / HTML related structs/classes.
- esbuild being faster than cargo build (incremental mode)
- not missing Enums / Traits from Rust much in WebApps
- dev console + TypeScript exception more useful than dev console + wasm32 exception
- pick a random JS / TS node library; IntelliJ TypeScript auto completion works; for Rust we need to write our own FFI
For those using both TypeScript and Rust, do you find TypeScript beats Rust for non-realtime WebApps ?
Yeah personally I think if you just want to write a normal web app you should default to TypeScript (or plain JS) for now. If there's shared logic that can fit relatively easily in the constraints of current webassembly you can maybe use Rust for that, if it lets you share code with the server.
The work that's gone into making it possible to write a web app in Rust possible is really impressive, but there's just not enough support in the standards to make the development process feel smooth right now.
Just don't expect to get the same guarantees from TypeScript. Practically all bolted-on optional type systems are unsound/inconsistent/have glaring holes, and TS is no different;
any is the
void * of the 21st century.
In theory, I agree with you. In practice, (1) TypeScript has been so pleasant and (2) web_sys has many functions that return a Option or JsValue (that we need to match on), so there's
unwraps all over the place in my Rust code.