This builds with no errors at compile time, but when I run it, I'm getting a ReferenceError when I try to use the net class. (net is not defined)
//chat.ts file
/// <reference path="../client/net.ts" />
class chat {
constructor(public chatHub: any) {
net.call(chatHub.server.getUsers());
}
}
//net.ts file
class net {
public call(callback: () => any): any {
//stuff here
return callback();
}
}
Things I tried:
All I want to do is use the utility functions on my net class from my chat class.
Did you remember to add the net.js file to the page (somewhere above the chat.js file)? Just referencing it in the TypeScript doesn't load it for you.
You either need to use the AMD module definition in conjunction with a loader like require.js, or make sure all the .js files you need are added (either one at a time, or bundled) to your page. All the comment reference does is tell the compiler where to find the type information.