TypeScript 0.9.x Not Compiling JS Files

Recently I started experimenting with TypeScript, as we started using it at my day job and I wanted to use it for Resgrid. I really like the concept of what TypeScript is and what it brings to the table and for non-JS developers like myself. But recently I have not had a lot of luck getting TypeScript working in my projects.

 

The first part of the problem is that when you Nuget in DefinitelyTyped definitions they are not set to TypeScriptCompile. Thanks to Jonas Eriksson @joeriks for that tip.

image

This was using the latest version of TypeScript 0.9.1.1 and the latest version of WebEssentials (the one with TypeScript removed).

But I still couldn’t get JS files generated from the TypeScript files. No errors in the compiler and only a few warnings. Finally I found this blog post from almost a year ago.

I edited my MVC Apps’s web project file (.csproj) and added this BeforeBuild target:

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

So it’s still not generating on saving of the TypeScript file, but at least it is now generating them on a build.

About: Shawn Jackson

I’ve spent the last 18 years in the world of Information Technology on both the IT and Development sides of the aisle. I’m currently a Software Engineer for Paylocity. In addition to working at Paylocity, I’m also the Founder of Resgrid, a cloud services company dedicated to providing logistics and management solutions to first responder organizations, volunteer and career fire departments, EMS, ambulance services, search and rescue, public safety, HAZMAT and others.


One thought on “TypeScript 0.9.x Not Compiling JS Files”

  1. Pingback: like it

Comments are closed.