Type Script is not generating JavaScript in my Vis

2019-01-18 23:33发布

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"

6条回答
在下西门庆
2楼-- · 2019-01-19 00:11

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.

查看更多
混吃等死
3楼-- · 2019-01-19 00:16

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.

查看更多
\"骚年 ilove
4楼-- · 2019-01-19 00:29

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.)

查看更多
叛逆
5楼-- · 2019-01-19 00:30

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.

查看更多
叛逆
6楼-- · 2019-01-19 00:30

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

查看更多
贼婆χ
7楼-- · 2019-01-19 00:36

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

查看更多
登录 后发表回答