Announcing 0.9.1

Announcing 0.9.1

Rate This
  • Comments 50

We’re happy to announce the release of TypeScript 0.9.1.  With this version we've focused on fit and finish, improving the compiler performance and rounding out the language and ASP.NET support.

Improved Performance

When we released 0.9.0, we introduced a re-written compiler and language service which scaled better for interactive use cases and supported many new 0.9 language features, including generics.  One side-effect of this re-write was that command line compiler performance was noticeably slower than in 0.8.3.  With 0.9.1, the compiler is now as fast or faster than 0.8.3 for almost all codebases.  With 0.9.1, we close many of the performance gaps introduced by 0.9.0, improving both interactive and compiler performance.  Windows 8 and 8.1 users of the Visual Studio plugin will also notice further performance improvements, as we've begun using the latest version of Chakra, the JavaScript engine, on those platforms.

New Language Features

Typing with 'typeof'

We’ve added support for the ‘typeof’ operator in type positions.  This allows you a way of referring to the type of an expression. This is especially handy for working with the shapes of modules, the static side of a class, and enums, which don’t otherwise have a name you can refer to.

module M {
    export function myFun(x: number) {
        return x;
    }
}

var m: typeof M = M;

Better 'this' handling

We've relaxed the restrictions on field initializers to now allow 'this'.  This means that classes can now contain both methods on the prototype, and callback functions on the instance.  The latter are particularly useful when you want to use a member on the class as a callback function, as in the code above. This lets you mix-n-match between ‘closure’ style and ‘prototype’ style class member patterns easily.

class Adder {
    constructor(public x: number, public y: number) { }

    addMembers = (evt: MouseEvent) => console.log(this.x + this.y);
}

var adder = new Adder(3, 4);

document.onclick = adder.addMembers;

No Implicit Any

In the TypeScript 0.8 releases, there was an experimental option to warn anytime the compiler implicitly inferred the type ‘any’ where it had not been explicitly stated by the developer.  Several teams discovered this and began to use it to ensure they were taking full advantage of the TypeScript type checker, and not having ‘any’ creep in accidentally.  With 0.9.1, we are adding full support to this option, which is now available through the ‘--noImplicitAny’ compiler flag.  For Visual Studio users, we now also support the <TypeScriptNoImplicitAny> project build option. 

var x;             // Error: Variable 'x' implicitly has an 'any' type

x = "foo";
x = 2;

function f(y) {    // Error: Parameter 'y' of f implicitly as an 'any' type
    return y + 1;
}

 Visual Studio support for ASP.NET projects

 

With 0.9.1 on Visual Studio, we have introduced better support for using TypeScript within ASP.NET applications.  Keep an eye on the blog for an in-depth look at the features that are now available.

Download

Get them while they're hot.  The updated downloads are available for Visual Studio, NPM and source through the TypeScript website.  Let us know what you think on the discussion forums and issue tracker.

Note to users of previous versions of TypeScript - there is a list of breaking changes with older versions listed here

Leave a Comment
  • Please add 3 and 4 and type the answer here:
  • Post
  • You guys should note that bool is no longer supported and boolean replaces it as the type name for true/false (boolean) values.... This broke a bunch of code for me (easy fix, but would have been nice to know as 0.9.0.1 did not break on bool vs. boolean.

  • @Josh - good point.  We've linked to the breaking change list in the past, so I'll update this blog to also point to it.

  • it looks like there is now support for project references?   is this functionality in the visual-studio plugin?    if it is (or if not) could you guys do a blog post about how to use this feature?

  • VS never gets done compiling on my end too.

    When running the same file on the commandline i get something about options null or undefined... (a jscript error).

  • Good stuff! How do we enable the "no implicit any" in VStudio 2012?

  • It would be great, if you updated the codeplex issues. Which issues are part of this release?

    This link shows one resolved and two open issues for 0.9.1:

    typescript.codeplex.com/.../advanced

    One of the main issues "typescript.codeplex.com/.../468" about the this handling was just resolved without any comment and without beeing assigned as fixed in version 0.9.1. After that, obviously nobody is watching the issue anymore...

  • As pointed here typescript.codeplex.com/.../1433 ,  TS 0.9.1 seems to be incompatible with internation versions of Visual Studio 2012 in the current state.

  • @jcchalte

    We're looking into it and hope to roll out a hotfix for it.

  • So far so good.  This version took my (admittedly very small) project from a 7 second to a 3 second compile time.  All tests still pass.  :-)

  • @Jonathan Turner

    Thank you for taking the time to answer me, and for your reactivity ! The 0.9.1 version seems really really nice. Our 150k lines project compilation time has decreased from 22-25 seconds to around 7 seconds (using node.js instead of the regular tsc.exe executable to compile).

    By using some code generation to generate typescript proxies to asp.net MVC services, knockout, require js and typescript, we are coding our intranet website almost as if it was a windows application, with full intellisense, strong typing, compilation errors, unit tests, reference management etc. This is really really awesome, keep up the good work !

  • As a side note, I don't know how many projects are using typescript right now, but if you are searching for some middle to large scale real world projects that uses your language, we could provide you with some feedback (about the language, the tools etc.), and even test incoming features if you want. I am the chief architect on one of those projects. Don't hesitate to contact me directly (jc.chalte@gmail.com).

  • I don't see any performance boost when we compile our T4 scripts. We have added a bunch of code to process the generated .ts files after T4 finishes to generate the .js and .min.js files. This code launches the tsc.exe using the Process class but it is still very slow. We don't have many scripts yet but it already take up to 3 minutes to finish where with 0.8 it took 50 seconds.

    Also the tsc.exe never ends when saving a .ts file from VS2012 (as reported earlier in this thread). Going back to 0.9.0.1 for now.

  • module m {

      export var v;

      function test() { return v ;}  //used to mean m.v, now its window.v ?! just had to fix my code re:

    }

  • @PaulSinnema

    Are you compiling each files one at a time or by batch ? If you provide a list of .ts files to tsc.exe, or better yet, if you provide tsc.exe a text file containing all the paths, it will be really faster, as it will only have to compute all references once. It will generate as many outputs needed, no change on your side, but in our projects, compilation time goes from 3-4 minutes to around 25 seconds.

    Next, you can go one step further by using Node.js. Next to the tcs.exe executable, you have tsc.js which can be launched by node.js. In our project, if we use node.js with tsc.js to compile instead of tsc.exe, we divide our compilation time by  4.

  • @jcchalte: That was a very good suggestion. Compilation is down to under 10 seconds now (with 0.9.0.1). We don't use Node.js in our project right now. Can you give me an example on how to implement that?

Page 2 of 4 (50 items) 1234