3 ms·
I've used typed languages before (C#), and I've used Javascript for 8 or so year, and yep, I too can't see what the hell Typescript brings. I also used Haxe, w
by real-dino 6y ago
I've used typed languages before (C#), and I've used Javascript for 8 or so year, and yep, I too can't see what the hell Typescript brings.
I also used Haxe, which was a similar typed language, that compiles down to Javascript, and writing typed language for an untyped environment was an exercise in frustration.
It's almost like the React trend to write CSS in javascript. It separates the end result from the code even more, and doesn't really get you anything other than the typescript tax.
Maybe one day I will have that aha moment and get it, but the only real reason I see to learn Typescript is if the industry deems it essential to learn.
One of my favourite things about Javascript is how expressive you can be in it. Some of the new ES6 stuff helps with this too, but at the point when you write Typescript, you might as well be writing in a whole different language.
But naturally every typescript fan has a few stories about 'type-safety' saved their bacon, and no stories about how they struggled with defining types for callback functions or getting everything scaffolded for hours.
- spion 6y agoTypeScript is a fundamentally different type system to most of the other mainstream languages (similarities exist only in typed racket and clojure's core.typed). The fundamental differences stem from the fact that it tries and succeeds to model almost all existing expressive dynamic JS constructs. The resulting different features include: * structural instead of nominal types (i.e. if it walks like a duck and talks like a duck, it is a duck) * mapped types let you transform object types into other object types: https://www.typescriptlang.org/docs/handbook/2/mapped-types.html https://www.typescriptlang.org/docs/handbook/2/mapped-types.... * conditional types let you apply conditional type transformations, and combine with mapped types to provide the equivalent of for comprehensions https://www.typescriptlang.org/docs/handbook/2/conditional-types.html https://www.typescriptlang.org/docs/handbook/2/conditional-t... * template literal types let you generate dynamic string types on the fly, which you can use in various places including property names: https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html https://www.typescriptlang.org/docs/handbook/2/template-lite... and so on. It does have a learning curve, and the tooling is annoying to set up.
- pjmlp 6y agoWhich means that what looked like a nice WebIDL like in version 1.0 has grown to Haskell level language features by 4.2. I expect Template TypeScript and Liquid TypeScript are not far off. My enthusiasm for it has died, and I enjoy just doing a plain old <script src="myfile.mjs"/> on my own projects.