This project is read-only.

Typescript debug ts files that are in other project

Topics: General, Language Specification
Feb 9, 2014 at 4:53 PM
I like much typescript. and I use it my code. but I have the following situation:

Is it possible add to typescript the possibility to have the typescript files in a independent project (in the same solution where they are used) like a normal C# dll?
I tested it and it is possible (I used the configuration proposed by Jonas Eriksson ) works very well, but I have only a big problem I can not debug the ts files and can only be able to debug the js files. I had passed the map files, but also was not possible.
I think that should be very usefull, the possibility of have the typescript project in a independent project, that generate only one js and the possibility to debug directly each typescript file, this give typescript a perfectly similarity with a C# normal project.
Maybe it is possible, if it please send me how I should configure the project, if not maybe it is a nice feature that you can incorporate in Typescript

Feb 10, 2014 at 5:32 PM
You should be able to use the --out FILE commandline option and still debug using the .map files. The .map files should be able to work across multiple .ts files.

If you're having an issue getting this to work, you might want to file an issue on the issue tracker and include a small version of the project that you're trying to do it with.

Something else to look into: if you're also moving the .ts files or .map file after compilation, you may need to mess with the --sourceRoot and --mapRoot, which let you set the paths in the .map and .js file so that the original source can be found.
Feb 11, 2014 at 3:02 AM
Thanks for your answer
Yes I moved the .js and .map files after compilation, because I am trying to use the typescript as a library project. I played with the source root without be successful to get the .ts files on debug.

One question, I try to access the files with complete path, maybe that is the error, Should always considerate the typescript project as a web project with web.config file?

I try to reproduce the problem in a small project.

Feb 11, 2014 at 5:04 PM
I believe both complete paths and relative paths should work, but it may be tricky to use the relative ones. You may also be able to use URLs, but I haven't tried.
Feb 14, 2014 at 3:36 AM
Thanks for your answers !

I made a small test project, and I can put to word the debug using urls. I was not able to work with specific path or relative path.
basically that happen is the application always point to the web site and forgot the fixed path if you use relative or absolute path. Maybe I make some wrong.

The example has a manual modification of the map file, for that I do not xcopy the map and js file to the main project. Basically I put the following in the root directory of the map file:


please I have some doubts about how to use this in a project that is hosted in IIS (this small example is hosted in IIS Express)
Is it a good practice maintain this projects in IIS Express and the rest of the project in IIS?
or is better to integrate the typescript project in the IIS?

The other thing that if the relative path works, then maybe is possible create a typescript library project without using web server. Can you give a example about to work with relative path? If you give me a link I can send you the example.

Thanks again for your attention
Mar 7, 2014 at 9:42 PM

I have a related question. I have created a CommonTypeScript project that I want to share between multiple projects in a solution and to reuse on some future projects.

I have this configuration working where I am accessing the common TS code from two different projects, but there is a problem with debugging. If I put a breakpoint on a node in the TS file and run a portion of the code that accesses the breakpoint, a blank TS file is displayed. It is labeled dynamic + the name of the original page that I set the breakpoint on. If I hit F5, one or more times, the code continues to execute normally. The problem is that I cannot debug any issues with this configuration.

If you want, I can try to generate a small test project that demonstrates the issue.

Any ideas?

Mar 8, 2014 at 1:29 PM

After some additional testing/experimentation I found the problem. The CommonTypeScript project was not configured to run on the IIS website associated with the other project(s). It was running on IIS Express. When the Visual Studio project websites are configured to the same domains (e.g., then the debug works properly with the shared code.

There is one glitch in my case. Since I have a secure domain and a unsecure domain in the same solution (i.e. two website domains), this means that I must switch the domains of the CommonTypeScript project to the domain that I want to debug. However, this is something I can deal with.