Say Goodbye To TypeScript Reference Comments

Feeds

RSS Feed

<< July | August | September >>

Thursday, 8th August 2013

I have no idea how I missed this, so a massive thank you to Mark Rendle for poking me in the ribs and pointing it out.

As of TypeScript 0.9.1 you don't need to mess about with reference comments in Visual Studio. Here is my test using plain old Visual Studio 2012 with the TypeScript extension:

mod.ts

module Mod {
    export class ModClass {
        doSomething() {
            return 1;
        }
    }
}

app.ts

var mod = new Mod.ModClass();
mod.doSomething();

And this works. It works in the Visual Studio editor and it works when I compile it using the BeforeBuild target in the project file.

...
    <Target Name="BeforeBuild">
        <Exec Command="&quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\tsc&quot; --out final.js @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
    </Target>
...

This does mean you have to clear up any old TypeScript files you aren't using as they do make it into the "final.js" file.

Note: Web Essentials 2012 isn't ready for this change just yet!

You Are Here: Home » Blog » Say Goodbye To TypeScript Reference Comments