11

For no clear reason, Typescript has suddenly stopped reliably compiling into JS code.

Using VS2012, Typescript for VS ver 0.8.3.1 and Web Essentials ver 2.6 (set to "Compile on Save").

I can create a new Typescript file and make simple changes to it (such as export a simnple var or function). I can save TS file and see the JS translation.

HOWEVER, once I add one or more TS definition files (I'm using AMD) and then edit the TS file, NO FURTHER CHANGES APPEAR IN THE CORRESPONDING JS FILE. Edits to the TS file will no longer update the JS. Typescript no longer checks for errors either.

Only when I close and reopen VS2012 will the proper JS file finally appear.

I've uninstalled/reinstalled Typescript, Web Essentials and VS2012 to no avail.

Does anyone have any suggestions on how I can fix this problem? I'm at a loss.

EDIT

This is an entirely reproducible condition. Today, I formatted my drive and re-installed VS2012 anew. USING 64-bit version of Windows 7. Created a new MVC4 project. Created a new TS file. Added a couple of definition files. Attempted to edit the default getDist() function. Saved. No update to the JS file. Removed the definition files. Saved. JS file is properly updated as expected.

IT'S IMPOSSIBLE TO IMAGINE THAT I'M THE ONLY ONE EXPERIENCING THIS PROBLEM!!

Please help!

RE-EDIT Problem solved. See below.

CCPony
  • 988
  • 1
  • 7
  • 20
  • Try creating a new project with different code and see if it happens there as well. – basarat Apr 28 '13 at 07:32
  • The only thing I can think of is that both Web Essentials and VS2012 could be trying to write to the JS file at the same time. If you haven't switched off compile-on-save in VS2012 > Tools > Options I'd do that so Web Essentials can be in charge of that. – Fenton Apr 28 '13 at 08:01
  • New projects result in the same problems. – CCPony Apr 28 '13 at 15:19
  • I'm not sure what you mean when you suggest that VS2012 and Web Essentials compete to write the JS files. I use Tools > Options to change Web Essential settings, but I don't see any other Typescript related settings. Regardless, I don't think that your suggestion would work since new TS files may be created but only fail once they become somewhat more complicated. – CCPony Apr 28 '13 at 15:22
  • 1
    @CCPony it would be a race condition, two processes trying to access the same file. The larger the file, the longer the process runs, the more likely a collision will occur. You can find the Visual Studio settings in Tools > Options > Text Editor > TypeScript > Project > Compile on Save (there are two tick boxes). – Fenton Apr 29 '13 at 07:44
  • Are those files by any chance read-only? – thomaux Apr 29 '13 at 11:42
  • Steve - thanks for the clarification. I checked and VS2012 was not competing for the JS files. Anzeo - none of the files (ts or js) are read-only. – CCPony Apr 29 '13 at 13:37
  • SOLVED! Do NOT change the default locations of DefinatelyTyped files that are loaded into your project from NuGet! – CCPony Apr 30 '13 at 02:46
  • Are you sure you didn't just need to update the reference paths inside those `d.ts` files from DefinitelyTyped? Many of those files refer to each other (many, for example, refer to the JQuery `d.ts`), so if you change your file structure you have to update a few paths. – Jude Fisher Apr 30 '13 at 09:53
  • JcFx - exactly right! As you can clearly see, I'm just getting started with this technology. I do wish, however, that there could have been some sort of error message or exception thrown. – CCPony Apr 30 '13 at 16:47
  • @CCPony - you may need to update your tools. In VS 2012/Update 2, with Web Essentials 2012 2.6, I get errors in both the WE output panel and the VS Error List whenever a reference path is incorrect: `Incorrect reference: file "wrong\path\to\jquery.d.ts" does not exist` – Jude Fisher May 01 '13 at 07:49
  • 2
    i have the same problem, I have no solution found yet... – daniel Jun 18 '13 at 13:25
  • @CCPony You should post your resolve as an answer so that this question can be closed. – Zze Dec 10 '17 at 05:32

2 Answers2

0

it happened to me,

i solved this issue by setting the build action of the ts file to TypeScriptCompile

Nati Krisi
  • 1,023
  • 1
  • 12
  • 23
0

Please see : Preview pane for TypeScript missing and/or not updating in VS2012/13

Also check that there are no compile errors in the TS files - a language update can create an error without you noticing, and the new version of WE simply does not update the preview pane like it used to.

Community
  • 1
  • 1
Dean
  • 731
  • 8
  • 21