5 ms·
We've been using Turbo for over a year now (similar idea to Htmx). Pretty happy not to be using React anymore. Most of the complexity is offloaded to the backen
by levkk 3y ago
We've been using Turbo for over a year now (similar idea to Htmx). Pretty happy not to be using React anymore. Most of the complexity is offloaded to the backend where we can handle it better with a typed language system and no middle layer (e.g. GraphQL) between our app and the database.
TypeScript is not typed fwiw, e.g. `as any`.
- SahAssar 3y ago> TypeScript is not typed fwiw, e.g. `as any`. So because it has a feature to disable typing it is not typed? Would you say the same thing for any language that has similar "unsafe" flags, like rust or basically all the others?
- levkk 3y agoYou'd have to try very hard to override a type in Rust when that type comes directly from your database (see SQLx). Rust unsafe features don't allow you to override type safety, but you can directly manipulate raw pointers if you're so inclined. TypeScript really does let you bypass the type checking entirely and drop down to just JavaScript.
- SahAssar 3y agoYes, typescript allows you to do that. It is entirely voluntary and you can do untypesafe things in almost any typed language. I'm not sure how that makes typescript "not typed".
- hellcow 3y agoI think the parent is simply pointing out that “Typescript’s types are not sound.” That is, the types at runtime may not be what you assumed at compile-time. This happens very often at API boundaries because fetch returns `any`. Many languages do have sound type systems, and I would argue we should prefer those.
- jakelazaroff 3y agoThe fetch issue (and JSON.parse/localStorage.getItem/etc) can mostly be mitigated by using type guards to “parse” data at the point of ingress.
- SahAssar 3y agoThat is certainly one interpretation, but even then within most compile-time but not runtime-checked languages you can usually perform runtime checks. For example I've used Zod (https://zod.dev/ https://zod.dev/) quite a bit in typescript to do runtime typechecks at the boundaries.
- throwanem 3y agoI don't know much about Rust, but it has the same problem, doesn't it? As I understand it this is something the serde crate (at least) is often used to solve. This is reasonable, given that untyped data received at a system boundary is going to need some kind of type checking no matter what the language or type system; I'm not sure that can even be fairly called a 'problem'. But it also would leave the putative line of argument rather footless, in that blaming Typescript for something Rust also requires is incoherent. Perhaps the originator of the claim under discussion will clarify his meaning.
- SahAssar 3y agoI think we agree, or maybe you misunderstood what I meant?
- throwanem 3y agoWe agree, yeah. My argument is just that if you're accurately describing the argument that 'levkk is making, then 'levkk's isn't a meaningful argument: doesn't really do anything to indict one language or the other, at least if I've correctly understood serde's usage in what appears very much the identical use case.
- infogulch 3y ago| Static | Dynamic -------+--------+--------- Strong | Rust | (lisp?) Weak | TS | JS TypeScript bolts on a Static type checker onto JS, and the types are erased before running in a real JS runtime. At runtime the types can change out from underneath you for many local and nonlocal reasons. This is simply impossible in Rust in general.
- throwanem 3y agoSure, that's true. Under the same rule, C also isn't typed because void pointer casts are possible.
- dkjaudyeqooe 3y agohttps://github.com/hotwired/turbo https://github.com/hotwired/turbo
- throwitaway1123 3y agoWhat about the empty interface type in Go?[0] Is that just as problematic for you? [0] https://go.dev/tour/methods/14 https://go.dev/tour/methods/14
- throwitaway1123 3y agoCorrection: the empty interface is actually analogous to TypeScript's unknown type rather than the any type.