Developing with TypeScript

TypeScript is a programming language that is compiled to Javascript. It works on anything, so you can use it on any project.

TypeScript lets you write JavaScript the way you really want to.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
Any browser. Any host. Any OS. Open Source.

TypeScript is built in TypeScript which compiles to Javascript code that compiles TypeScript to Javascript.

TypeScript brings lots of advantages. With the typed system it is impossible to make mistakes sending wrong types. By being a typed language it allows IDEs to add powerful auto-completion, reference finding, refactoring mechanisms.

In TypeScript you can easily define interfaces, classes, enums, namespaces… You can use types, generics…

class Foo
{
    Bar<T>(something: T): T
    {
        return something;
    }
}

interface IEntity
{
    Name: string;
}

var foo = new Foo();

var e: IEntity;
var n: number = 0;

n = foo.Bar(10);
e = foo.Bar({ Name: "Bruno Michels" });

alert(n);
alert(e.Name);

Generates:

var Foo = (function () {
    function Foo() {
    }
    Foo.prototype.Bar = function (something) {
        return something;
    };
    return Foo;
})();
var foo = new Foo();
var e;
var n = 0;
n = foo.Bar(10);
e = foo.Bar({ Name: "Bruno Michels" });
alert(n);
alert(e.Name);

For more check the links at the end of the post.

Who uses TypeScript today?

  • Azure
  • XBox Music (over half million lines of code)
  • Bing
  • Adobe
  • Starling JS
  • turbulenz
  • HeliosJS
  • zud.io

TypeScript was introduced late on XBox Music development. They already had a large code base. So you can too, it is never too late to start using TypeScript.

And the newest one, Angular2 is going to use TypeScript.

See also

TypeScript Playground
TypeScript Samples
TypeScript Specification
TypeScript source code

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s