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 1 and 3 and type the answer here:
  • Post
  • re: module variable bug

    For me, 'v' points to 'm.v'.  Is this with 0.9.1?  Also, is that snippet alone enough to trigger the issue?

  • yes, new for 0.9.1 from 0.9.0.1

    no, I didn't check the actual code I listed, but I did have this - its a slice of a large multi-file module, this code compiled incorrectly (this is a change from GIT)

    module Panter {

       export var allForms =null;

    //lots of code in between

        export function GetFormById(id: string) {

    -         var form = allForms[id];

    +        var form = Panter.allForms[id];

            return form;

        }

  • @Georgios To enable NoImplicitAny in Visual Studio, edit the .csproj file's XML and add in a <PropertyGroup> <TypeScriptNoImplicitAny>true</TypeScriptNoImplicitAny>

  • @ASP.Net Development Server incorrect signature (?)

    if you want to compile with node.exe (V8 Javascript engine) instead of TSC (Chakra, I believe), you just have to call node.exe (downloaded from here http://nodejs.org/ ) instead of tsc.exe, and give him the path to tsc.js in the first argument. Your command line should now be something like this :

    "C:\JCC\Dev\Assemblies\ScreenScriptPrecompiler\node.exe" "C:\Program Files (x86)\Microsoft SDKs\TypeScript\tsc.js" --module AMD  FilesToCompile

    Just be aware that command lines are limited to 8k characters. This can cause problems if you have a huge list of files to compile. You can use the "@" argument to specify one text files containing all the path to all the files to be compiled instead to override this 8k character limitation.

    In our csproj, we have added one action in the BeforeBuild that create this file

    <Target Name="BeforeBuild">

       <WriteLinesToFile File="tscCommandLineArguments.txt" Lines="@(TypeScriptCompile ->'"%(fullpath)"', ' ')" Overwrite="true" Encoding="Unicode" />

     </Target>

    This create a file called tscCommandLineArguments.txt alongside the csproj, with all the typescript files separated by commas. We can then call tsc with the "@" parameter, in our case :

    C:\JCC\Dev\Assemblies\ScreenScriptPrecompiler\node.exe "C:\Program Files (x86)\Microsoft SDKs\TypeScript\tsc.js" --module AMD  @C:\JCC\Dev\Web\tscCommandLineArguments.txt

  • 'ASP.Net Development Server incorrect signature' (don't know how that happened). I am logged in via 'Live' and that way I can not enter a name.

    @jcchalte: Thanks for the explanation. I'll try and implement that. We use T4 code generation to generate the .ts files. Because we have all the names gathered from the assembly in our Metadata classes we can output a file with the corresponding generated .ts files from withing the template.

  • re: module variable bug

    This one also seems to work for me.  Probably the best thing to do at this point to help us track down the issue is to file a report here: typescript.codeplex.com/.../Create - if you can, supply enough of the code that it triggers the issue so that we have enough to repro it on our side.

  • I'd stay away until this issue is resolved: typescript.codeplex.com/.../1465

    I spent the majority of today migrating our codebase to be compliant with the changes to the latest compiler only to hit this roadblock.

  • he TypeScript Extension stopped working in a German Release of Visual Studio after upgrading from 0.9.0.1 to 0.9.1

    The error description from the visual studio activity log is:

    could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "TypeScriptLanguageService.VsPackage.Strings.resources" was correctly embedded or linked into assembly "TypeScriptLanguageService".

    I'm running VS 2012 Ultimate (German) with TypeScript, latest Version of WebEssentials and Nuget Package Manager

    typescript.codeplex.com/.../1433

  • A temporary fix for this issue : just install the Visual Studio 2012 Language pack (www.microsoft.com/.../details.aspx) and change VS language to English (Tools -> Options ->  International settings).

  • I just updated my installation to 0.9.1 on a Mac with OS X 10.8.4

    From the terminal, when I enter the command to see the version of Typescript (tsc -v), instead of getting only the release version I'm also getting the entire help documentation.

    I'm not sure if this is a bug or a desired behaviour, but IMHO it would be better if the typescript compiler could only output the release version.

    This is an example of what I mean:

    What I'm actually getting:

    Computer:~ User$ tsc -v

    Version 0.9.1.0

    Syntax:   tsc [options] [file ..]

    Examples: tsc hello.ts

             tsc --out foo.js foo.ts

             tsc @args.txt

    Options:

    [ FOLLOWED BY A LOT OF OTHER LINES ]

    What I'd like to get instead:

    Computer:~ User$ tsc -v

    0.9.1.0

    Thank you very much and best regards

  • Compile times are very good with this release.

    However the IDE performance in VS2012 is terrible.  Renames, Goto and intelesense are all non functioning 95% of the time.

    Also 1 real error in my code can produce hundreds of errors in the error list.  Which isn't very helpful in working out what is wrong.

    I hope these things are high on the priority list as it's really affecting productivity.

    Cheers.

  • I have the same issue... seems to be getting a lot worse as the number of TypeScript files and lines grows. I'm using Web Essentials, so I don't know how much of the blame goes to that plugin compared to the TypeScript Visual Studio plugin. It seemed to work a lot better in 0.9.0, I think the new implicit references between all TypeScript files in Visual Studio are making it worse. I've been using the tsc compiler from the command line because, for some reason, most of the time the real errors aren't even appearing in Visual Studio. For example, yesterday it kept saying my file had no errors, but refused to generate any javascript anyway. After adding the references and running the compiler manually from the command line I found out the code was using a deprecated JQuery function that was no longer there. Fixing that one error made Visual Studio resume generating the JavaScript.

  • I think it is time to ditch all the web essentials functionality.  I made the move to use use just the typescript plug in on the last release and it cured a fair few ills for me.

    Right at the moment I do a build on the project that contains all my type script and can be sure that if I get a build success it's ok and if I get a build failure there is a problem.  Although when I get 1 problem it is hard to locate the real issue due to the amount of errors thrown out and I do think that some times it does fail to list the real error in the list of errors.  

    However I am now in the habit of doing a build after every bit of code I change so that if I do get a problem at least I only have a few lines of code to review to spot the mistake.

  • I'm still on 0.8.3 because each version release since 0.9.0 has reports of performance problems / visual studio misbehavior in the comments here.

    0.8.3 works fine in visual studio but I'm still waiting for a more stable 0.9.x

  • This version is creating memory issues. As soon as I open a TS file, devenv memory is jumping from 250MB to 3GB. I ruled out web essentials is not the cause. I uninstalled TS compiler and there is no spike in memory. So, I think it has some thing to do to with this version. How can I resolve this issue?

Page 3 of 4 (50 items) 1234