This project is read-only.

Missing something after updating to 0.9.1

Topics: General
Aug 30, 2013 at 2:05 AM
I recently updated all of my packages and tools. Until recently TypeScript was part of WebEssentials. I know it's been removed from WebEssentials, and I've downloaded and installed the 0.9.1 installer, but I must be missing a step. I can create new TypeScript files, but they don't get compiled into JS files. I've checked my setting in Tools > Options but I don't see anything for TypeScript.

I've searched around but haven't found anything on the subject - all references just say to download and install the 0.9.1 installer from Microsoft.

I don't know if there are any compatibility issues, but my system is Win7 Pro, running VisualStudio Pro 2012 update 3.
Aug 30, 2013 at 1:26 PM
You need configure vs project to compile ts files:

Also every ts file should have buildAction = TypeScriptCompile
Aug 31, 2013 at 5:16 PM
Hi fabioparra,

Thanks for the tip. The link seems to address compiling on save. The problem I'm having is this not only are they not being compiled on saved - they aren't being compiled at all. I have buildAction = TypeScriptCompile for each of the TypeScript files, yet doing a complete rebuild doesn't generate the .js files. I went into Tools > Options > Text Editor > TypeScript > Project and turned automatic compile on, but they still weren't getting compiled.

I then followed the instructions in the page you pointed me to, and added <PropertyGroup> and <Import> sections mentioned, and I'm now able to compile my TypeScript files into JavaScript files, but there still are some issues...
  1. I have to add:
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" /> every MVC project which is using TypeScript. Not a big deal with the main project I'm working on (set it and forget it), but I constantly am creating new (temporary) MVC projects which I use to play around with and experiment with, and each time I do I have to re-add these configuration settings.
  1. Prior to the upgrade, opening a TypeScript file would display the TypeScript code and the generated JavaScript code side-by-side. After upgrading, only the TypeSscript code is displayed.
  2. Prior to the upgrade, if there was an error in an opened TypesScript file, the file would not compile and there would be an error in the JavaScript pane of the editor.
  3. Prior to the upgrade, in the Solution Explorer window the .js and the files were nested within the .ts file. They aren't any longer and if I wish to open either, I have to turn on "show all files".
So, at the moment I have a workaround (thanks again for the tip, fabioparra), but this seems a little clunky and I liked it better when WebEssentials included support form TypeScript. I haven't heard of anyone else mentioning this, so I'm wondering if everything is working correctly on my system. I installed TypeScriptSetup. (from the installer provided by Microsoft). Is there anything else I need to install? Or are we supposed to add those config changes to each csproj we work on?

Thanks for the help,

Sep 1, 2013 at 12:04 PM

After TypeScript no longer includes the generated JavaScript files. For me this is a good thing, most importantly because it doesn't clutter up source control.

Both points 1 and 3 that you make are to do with inspecting the output generated by the TypeScript compiler.

Out of curiosity why do you need to do that? Are you worried that the generated JavaScript is wrong?

I personally un-installed web essentials after the first week in October 2012 and haven't had a need for the features it provides since.

The number of times I actually have to inspect a generated JavaScript file has fallen to perhaps once a week (although we always see the output when debugging in the browser, because we don't use source maps). This is mostly to do with increased confidence in the TypeScript compiler as the bugs get fixed and things become more stable.

Regarding the MVC project issue, I would move the TypeScript files out of the MVC project and have them as a separate TypeScript project: File > New > Project > TypeScript > HTML Application with TypeScript . The correct project settings are included automatically for you.
Sep 4, 2013 at 1:40 AM
Thanks nabog!

I didn't realize that the TypeScript compiler no longer generating the JS files (and when it didn't I thought something was wrong).