13

I am using Visual Studio Community edition 2015 for development, I have added *.ts file to my project but its not automatically compiling. Also it does not show JavaScript preview pane. This post How do I enable the preview panel for TypeScript files in Visual Studio 2015? says that it's not supported anymore. That's fine, but why it's not compiling?

I referenced Missing Typescript Options in Web Essential for Visual Studio 2012

It says Split panes have been reintroduced in the latest version of web essentials http://vswebessentials.com/features/typescript but I can not see it

I do have typescript exe in following folder

   C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5

I do have settings in Project Properties as follow

enter image description here

I do have settings as follow in Visual Studio

enter image description here

I see comment in http://www.typescriptlang.org/ as below

"Visual Studio includes TypeScript in the box, starting with Visual Studio 2013 Update 2. You can also edit TypeScript in VS Code, WebStorm, Atom, Sublime Text, and Eclipse"

What may be issue?

Solution

My "typings" file for jquery was out dated, I upgraded it and it resolved other errors and build was success, then JS files got generated.

Below post helped JQuery definition screwed up with TypeScript 0.9

I can not close this question because I am still not able to get 'Preview Pane"

1

6 Answers 6

19

I regularly encounter this issue in VS 2015 and VS 2013. My solution is not a pretty one, but it works for me...

  1. Close Visual Studio
  2. Go to your scripts folder, delete all JavaScript files that have corresponding TypeScript files (only necessary to do this for TypeScript files that you have created for your project)
  3. Open Visual Studio, clean, and build

If this doesn't work, open each TypeScript file, change one character, Save, re-build... hopefully the file will re-compile.

If this still doesn't work, open a Node.JS command prompt, change directory to the scripts directory, run;

tsc "yourfile.ts"

If this doesn't work, you've got bigger problems.

5
  • 2
    clean build shown some other errors, and resolving it resolved my basic JS file generation problem. your answer partially helped me
    – kudlatiger
    Aug 7, 2015 at 1:20
  • 1
    I'm having this issue frequently (Visual Studio 2015 Update 3). The two tricks in my arsenal that seem to help are (1) doing a Clean & Rebuild in Visual Studio (as already mentioned by Jon Preece), and, (2) in the Chrome browser, bringing up the Dev Tools using F12 and, while the Dev Tools are displaying, clicking on the Refresh button. Sometimes one helps, sometimes the other helps. I wish there was better, more automated way to not have to keep wondering if the problem is the code or the caching. Jul 4, 2016 at 7:22
  • For me the solution was to MANUALLY updtae the Typescript version to be above 1.7 in the win10 path variable, using this post: stackoverflow.com/questions/31750964/…
    – Dudi
    Aug 18, 2016 at 16:38
  • Just deleting the .map and .js files worked for me. Didn't have to close VisualStudio Nov 23, 2016 at 18:19
  • 2
    Just editing typescript file, re-saving and re-building project worked for me. Dec 26, 2016 at 13:04
8

Make sure that you highlight the project in the solution explorer and then click the icon at the top that says "show all files" after you have compiled the project. You will then see the .js and maybe a .js.map file (greyed out). Select the files and then right click and 'include in project' and things should be good from there.

1
  • This was the right answer for my specific problem. I was using Visual Studio 2017 Community Edition, and by default it only shows the .ts files but not the .js or .map.js Jul 9, 2018 at 0:32
5

Some false-errors in my ts caused the issue, fixed by uncheck "Do not emit outputs if any errors are reported"

enter image description here

(The false error is from an outdated DefinitelyTyped file, the generated js file does not have any error.)

1
  • This one worked for me like a charm. I noticed a message down during save changed tsx file: typescript compile on save errors output generation was only partially successfull (or similar). I tried almost everything which did not work. This one overcame the obstacle in my case.
    – Honza P.
    Feb 26, 2020 at 6:35
3

Maybe not having the option to expand the .ts file and see the generated .js can cause a confusion here.Try to compile your solution. Click on Show All Files and you must see all the .js generated in the same folder of your .ts files. Include your .js in the project if you want to have them visible as part of the solutions. Hope this helps

enter image description here

1

I know you say you added the .ts file but did you right-click and select 'include in project'. This will add it to the list of files that Visual Studio will check for TypeScript transpiling.

-1

You need install Web Essential then restart the Visual studio -> clean Solution -> Rebuild it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.