Blog Post

Microsoft attacks JavaScript scaling with TypeScript

Microsoft(s msft) is adding yet another langauge — TypeScript — to a roster that already includes Visual Basic, C# and F#. TypeScript is a superset of JavaScript, a language originally meant to build web pages. The goal is to bring more enterprise class features to JavaScript, the use of which has exploded among corporate developers.

The reason?  It’s time for the scrappy language to grow up to better support the creation of enterprise applications, according to a blog post by S. Somasegar, corporate VP of Microsoft’s developer division.

Somasegar wrote:

TypeScript is a superset of JavaScript that combines type checking and static analysis, explicit interfaces, and best practices into a single language and compiler. By building on JavaScript, TypeScript keeps you close to the runtime you’re targeting while adding only the syntactic sugar necessary to support large applications and large teams. Importantly, TypeScript enables great tooling experiences for JavaScript development, like those we’ve built for .NET and C++ and continue to innovate on with projects like “Roslyn”.  This is true whether you’re writing client-side JavaScript to run on Windows, Internet Explorer, and other browsers and operating systems, or whether you’re writing server-side JavaScript to run on Windows Azure and other servers and clouds.

TypeScript adds static typing to the mix. That means the compiler will flag an issue up front if the developer assigns an incorrect data type to a variable instead of waiting till the program runs, as dynamically typed languages — including JavaScript — do. That delay can lead to problems when the program does run.

An early preview of TypeScript is now downloadable from this site

For more on TypeScript check out the video by Microsoft Fellow (and programming language superstar) Anders Hejlberg.

10 Responses to “Microsoft attacks JavaScript scaling with TypeScript”

  1. John Smithenson

    Boo to static types? Obviously most script kiddies have never worked on really large applications.
    Any help you can have to find possible problems are such a bonus…

    • If you look at the TypeScript language, I think you’ll see that it is very close to ActionScript 3. It uses ActionScript 3 type syntax to declare the types for variables, classes and even inheritance. However in some ways TypeScript is ahead of ActionScript 3. For example TypeScript sports better type checking when assigning functions to variables, and it supports method overloading. At any rate based on what I’ve seen from TypeScript, if you’re an ActionScript 3 developer you’ll probably feel right at home with TypeScript.

    • It’s optional, so you don’t have to use it when it gets in the way.

      In other cases though, having defined types, especially across different areas of a code base, really helps avoid debugging headaches. The “make change, run to see if it works, see it doesn’t, make more corrections, repeat” loop can only scale so far before you realize the code is just unmaintainable. With static types the compiler can at least help identify all your problem areas so you don’t have to check yourself at runtime.

      • Edwin Yip

        Agreed, static typing has that advantage. Remember those complains about the code completion features for dynamic typed languages are weak?

        Now things will be changed. I’m developing a text editor for lively editing and testing html/css/js, the next major will be the implementation of code completion (intelleSense), with plain JS I doubt I can go any further than the others, but with TypeScript, things will be better, I guess.

        PS, link of my live code editor mentioned above: