I like what they've done. Nothing too revolutionary, mostly adding static typing to Javascript without straying to far from the existing (or future) language or increasing the noise significantly.
Here's some highlights:
* Type inference
function f() {
return "Hello World!";
}
Will do the right thing
* Explicit Typing
function f(s: string) {
return s;
}
* 'Ambient Types'
To facilitate integration into existing JS libraries or the DOM, TypeScript lets you specify 'placeholders' for variables / classes that the runtime would expect to see e.g.
declare var document;
Almost a kind of dependency injection but also a neat way to manage talking to existing code.
Are you actually implying with the above example code that you can call a undefined "super" constructor on an interface and pass it the "balance" variable, which the interface's non-existent constructor would presumably match by name?
Nope. I probably should have used a different example for the interface. The examples are from the full spec where they progress a little more gradually from a BankAccount interface to a BankAccount class to a CheckingAccount subclass.
http://typescript.codeplex.com/documentation
I like what they've done. Nothing too revolutionary, mostly adding static typing to Javascript without straying to far from the existing (or future) language or increasing the noise significantly.
Here's some highlights:
* Type inference
Will do the right thing* Explicit Typing
* 'Ambient Types'To facilitate integration into existing JS libraries or the DOM, TypeScript lets you specify 'placeholders' for variables / classes that the runtime would expect to see e.g.
Almost a kind of dependency injection but also a neat way to manage talking to existing code.* Structural Typing
* Classes and Interfaces
* Modules * Arrow function expressions