TypeScript at Slack
slack.engineering
slack.engineering
I keep trying to get my head around javascript, and each time end-up walking away metaphorically shaking my head in disbelief. I suspect that this is because my background is in languages like C/C++/C#, so I'm wondering whether TypeScript might provide a way in for someone like me.
Which parts are you having problems getting your head around? Typescript doesn't change anything fundamental about the language (especially if compared to ES6), but does add a bit of nice syntactic sugar and (optional) compile time type checking, which is really handy for catching certain bugs and making your code easier to read and reason about. Typescript's big advantage (and disadvantage) is that it is a strict superset of JavaScript. This means that all your existing JavaScript code is already valid Typescript code and so you can move your code from JavaScript to Typescript in small incremental steps. The downside of this is it places some limits on how the language can evolve.
If you want a web language that 'feels' closer to C++ or C#, your best bet is probably to check out Dart.
Michael Feathers put it best in my opinion. You want to have a kind of vise on your code so that you can hold one part in place and be able to reason about the other part. Tests give you that ability.
Static type checking eliminates the need for a whole class of tests. It's great. The key, though, is that the type annotation system has to be convenient and readable. Lately I've been playing with Haskell derived languages and it's really incredible how much you can push into the type system. But it's important, I think, to realise that this is a convenience. You can still do it all by hand if you have to. It's always a balance of what you can do efficiently with language syntax and what you can't.
Or, maybe a bit more concisely, if the language doesn't help you, you can still help yourself. It takes more code and more discipline, though.
don't click it, read it and upvote it and especially don't make unnecessary comments.