Initial thoughts of TypeScript
Firstly, coming from a .NET developer background, my first thought was that TS reminds me of F#! By that I mean, first it builds on top of JS to give more functionality in a similar way that F# builds on top of the functionality of C#. Ironically some of this is accomplished by “removing” functionality e.g. static typing, just like F# introduces immutability which initially seems like a restriction but actually is a boon.
The type inference also reminds me of F# is that the output of methods is inferred from the return type from the method, or how you can define fields within the constructor directly. In fact, it makes me wish that C# had better type inference – and it just goes to show you can do more powerful type inference without more CLR support.
All in all, it looks very nice – basically gives you more intellisense, refactoring opportunities e.g. rename, lambda expressions, implicit closures etc. which are very C#-like.
Initial thoughts of TypeScript – with feeling
Yet there are many comments on the following tangent: –
- It’s from Microsoft. Ergo, it’s crap.
- It’s from Microsoft. Ergo, it must have some hidden nefarious purpose.
- It’s from Microsoft. Ergo, it won’t be secure.
- It’s just another Dart. What’s the point. Oh it must be competing with Google for the sake of it.
- They’re trying to lock me in to the Microsoft tool-space etc. etc.
- Static typing is crap.
- This will just fragment the JS community by creating a different version of JS.
- I can write JS directly, what do I need this for?
What a load of tosh! Anything that allows me to refactor a method or property name easily, or gives me intellisense for exploring an API is definitely a good thing. It doesn’t affect the runtime – it’s still spitting out plain JS. It doesn’t require me to learn lots of new things if I’m a JS developer. The language builds on top of JS – so you can opt-in for the bits that you want. It’s open source. What’s the problem?
Of course – it’s written by Microsoft.