Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type Script is not generating JavaScript in my Visual Studio Community edition 2015

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"

like image 995
kudlatiger Avatar asked Aug 06 '15 02:08

kudlatiger


People also ask

Does Visual Studio community support JavaScript?

Overview. Visual Studio 2019 provides rich support for JavaScript development, both using JavaScript directly, and also using the TypeScript programming language, which was developed to provide a more productive and enjoyable JavaScript development experience, especially when developing projects at scale.

How do I add JavaScript to Visual Studio?

With your project open in Visual Studio, right-click on a folder or your project node in Solution Explorer (right pane), and choose Add > New Item. In the New File dialog box, under the General category, choose the file type that you want to add, such as JavaScript File, and then choose Open.


2 Answers

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

like image 126
Zinov Avatar answered Oct 15 '22 14:10

Zinov


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.

like image 45
Jon Preece Avatar answered Oct 15 '22 13:10

Jon Preece