Using TS code between projects

Topics: General
Apr 19, 2013 at 5:57 PM
I've just been getting into typescript, due to being much more comfortable with C# than Javascript, and so I've been trying to rewrite my small game library to use TS and canvas rather than XNA. I've gotten a few classes written up, and now i'm trying to use them in another TS project.

To keep things simple, I've put my classes into the new project directly, in the GameLib/Core/... folder. Now when I try to use this in my app, I can't get it to recognise these classes. Using:
/// <reference path="GameLib\Core\Engine.ts">
Which doesn't error, but I can't access the Engine class, or the "Core" module that it is within. Any ideas what I'm doing wrong?
Apr 20, 2013 at 4:17 PM
Obviously the first thing to ask is if you have your path right. Double check, because we all make dumb mistakes (I know I sure have). The next thing is that I noticed that you don't close your reference tag <reference ... />. I have no idea if that even matters, but mine are always closed. Finally, if all else fails, you definitely might have found a bug in the compiler. I know that I've gotten some really weird scoping bugs before, so it's not impossible. If you're using Visual Studio, try to compile the code from the command line using tsc directly, that way you can be sure it's not a bug in the VS plugin.
Apr 20, 2013 at 4:41 PM
GJK wrote:
The next thing is that I noticed that you don't close your reference tag <reference ... />. I have no idea if that even matters, but mine are always closed.
Yep, that was the problem... mistake on my end xD