Organizing ts projects...

Topics: General
Dec 12, 2013 at 1:11 PM
Let’s say that you have two TypeScript projects named app and app-shared. Both project are located in clients folder and for app »Combine JS output into file« is set to »out/app.js« and for app-shared is set to »./../app/out/app-shared.js«. Output files are generated as expected and also map files point correctly to ts files. The problem is that debugging of ts files doesn't work, because path of ts files pass over root web folder and browser is not able to read them.

So is there any way to hack this. The obvious solution is to put app-shared in app folder, but I don't like this organization, especially when you have lots of projects and also for situations where different application may reference same project!

Here are some more question related to this:
  1. There was a talk, that Microsoft will provide TypeScript library project. For now you can use Web TypeScript project, but I really miss clean TypeScript library project.
  2. If you select single file output than AMD and CommonJs options don't work. This will be very nice, so that I can split application to 5 projects and get 5 js files which are then loaded using AMD. It's much easier and cleaner then generating hundreds of js files and then combining them together with AMD tools. The same is true for server side, but there at least you don’t get performance penalties when referencing individual files.
  3. If I set Module system to none I would expect that files will be generated even if I have used export module in ts source, of course without module implementation. But I get compiler error! This is probably default behavior but in situation where you are sharing source files between client and server this can be very useful, because you can get three different output from the same source: AMD, CommonJS and without. So simply saying, I think that in this case compiler option should override your source files settings.
Thx for response…
Dec 18, 2013 at 1:23 PM
Edited Dec 18, 2013 at 1:25 PM
My solution is to make the js output file in a folder that debugger can read it. following is an folder example:

| |-------TypeSriptLibrary1.sln
| |-------Class1.ts
| |-------Class2.ts
| |-------TypeSriptLibrary2.sln
| |-------Class3.ts
| |-------Class4.ts
| -----HostWebProject (this will be mapped to a folder in IIS)
| |-------HostWebProject.sln
| |-------Scripts
| | |-------TypeScriptLibrary1.js (this file is copied from 'Scripts' folder under 'Source' folder)
| | |-------TypeScriptLibrary1.d.ts (this file is copied from 'Scripts' folder under 'Source' folder)
| | | (this file is copied from 'Scripts' folder under 'Source' folder)
| | |-------TypeScriptLibrary2.js
| | |-------TypeScriptLibrary2.d.ts
| | |
| |-------Class5.ts (will reference .\Scripts\TypeScriptLibrary1.d.ts)
| |-------Class6.ts (will reference .\Scripts\TypeScriptLibrary2.d.ts)
| |-------Cosumer.html (this is the page which will include Class5.js, TypeScriptLibrary1.js and TypeScriptLibrary2.js)
|-------Scripts (this is the folder the generated js file of TypeScript library project)
| |-------TypeScriptLibrary1.js (this file are generated by TypeScriptLibrary1 project
| |-------TypeScriptLibrary1.d.ts
| |
| |-------TypeScriptLibrary2.js
| |-------TypeScriptLibrary2.d.ts
| |

If this dones't work for you, you can change the relative path of Scripts folder(such as make 'Scripts" folder to be at same level of 'Source' folder), you will definitely find a folder structure works for you.

Hope this will give you some clue.
Feb 9, 2014 at 10:47 PM

I try to do the same as you, but it does not work for me. I have my ts files in a class library. I try also to change the reference path inside the map file to pointer my library, but also does not work, neither vs or chrome was able to debug, but also neither complains about error. I missing something?

Feb 10, 2014 at 6:15 AM
Please check IIS setting to see if *.ts file is blocked, Add ".ts" MIME type in IIS to see if you can debug.