> TypeScript compiles down to JavaScript, which doesn’t have types or type checking, it’s impossible to have actual type checking. The TypeScript compiler is great at checking at compile time, but at the end of the day, it’s impossible to actually check the types. I'll point out that C/C++/Haskell compiles down to Assembly, which doesn't have types or type checking. GCC/LLVM/GHC is great at checking at compile time,…
Reservations about TypeScript
31–34 of 34 posts
Re: Reservations about TypeScript
#32> TypeScript compiles down to JavaScript, which doesn’t have types or type checking, it’s impossible to have actual type checking. The TypeScript compiler is great at checking at compile time, but at the end of the day, it’s impossible to actually check the types. I'll point out that C/C++/Haskell compiles down to Assembly, which doesn't have types or type checking. GCC/LLVM/GHC is great at checking at compile time,…
Good point. That being said, TS does suffer from something unique, in its JS interop. If my C program interfaces with a C library, I have great certainty that all of these were compiled at some point, and the types are sound (as much as C allows, at least). In TS, if you're lucky a library you consume was written in TS, so you've got high certainty that the typings it comes with are really good. Less lucky: the devel…
In my experience, even if you don't have types for a third-party library, you can get away with adding types for the interfaces you care about.
Re: Reservations about TypeScript
#33First point: "I found a bug but can't give an example." Second point: "It adds a feature that's different from a similar language." These are not persuasive arguments. I'm not trying to be unkind, but the first point is totally unsupported and the second doesn't elaborate on what's bad about classes besides that another language also has classes.
Definitely agree on the first, that's a good point. I probably should've been better about how I presented the data. "TypeScript still compiles down to JavaScript. It has no way of actually checking types." That's my point. Maybe I should make it more obvious in the article :) I'm not complaining about the fact that TS has classes or types, it's that TS compiles down to a language that has neither.
What languages compile down to a language that has either? Most languages compile down to either machine code, or virtual machine code.
Re: Reservations about TypeScript
#34It's a work of art, everything is so practical and (relatively) easy to understand. Even better, it's written in TypeScript, so you can open it up in an editor with TS support and follow/jump to any reference with confidence. I've only learned about compilers vaguely through osmosis, but I was able to extend its JSX syntax processing (admittedly that part does seem a bit bolted-on) to output JSON for my wonky framework side-project in a few hours: https://github.com/guscost/protozoa-tsx