by dmitryminkovsky · 5y ago · 0 comments
- At this point you can say TypeScript is mainstream. It's not Java, but it's definitely not a niche toy.
- Many companies stand behind it and use it in production.
- It is widely supported by tooling.
- With TypeScript, every element of your stack can not only share code, but can share types, too. This has been a huge boon for me.
- The type system is really, really flexible. It seems possible to specify the exact degree of safety that you want for any given situation. I never feel bound by the type system. It's very liberating. Not so with Java or C#.
- It compiles to JavaScript, so it can run anywhere. On the backend you can run it natively with Deno. I haven't tried this yet, but am looking forward.
Personally this is why I believe all languages will converge into the structural, gradual typing model of Typescript.
Typescript allows you to not make typing very strict when it's not important, but also allows you to define things stricter than your average Haskell codebase.
Most other languages have only 1 option about how strict a piece of code is typed.
My question was: what benefits would I get from sometimes not knowing the types at compile time (which is what I guess gradual typing is)?
How many Java apps do you think are out there that are not even worth the energy that they're using to run? How many absolutely asinine startups selling DRM-controlled juicers or internet connected water bottles or NFTs?
I'm not saying that every project that runs on Node or Python or whatever is worth the extra energy it uses, but this is kind of a silly argument to make with the kind of stuff coming out of the tech industry these days.
It just does not fit together. Want functional? Go with Haskell/OCaml/ReScript/etc. Want JVM compatibility-and-thus-OO-at-the-core (possibly with some functional goodness on top)? Go with Kotlin.
Just like any language, just use the bits you need for your project and apply KISS (Keep It Simple, Stupid) liberally! :)
https://visualstudiomagazine.com/articles/2021/04/01/typescr...
We have auto-published types generated from OpenAPI specifications that we use in a lot of different projects and it's been really awesome.