I am having an impossible time trying to get TypeScript debugging working in Chrome Dev Tools. I've generated source maps for all my .ts files, and the javascript looks correct, but Chrome only loads the js file that is referenced in index.html and ignores all the modules. This kinda makes sense, because the Typescript compiler does not seem to be doing anything with my modules. If someone could explain what I'm doing wrong in the following example, that would be great.
My project setup is like this:
root/
src/
Company.ts
User.ts
app.ts
index.html
Company.ts
module Company {
export class Job {
public title:string;
public description:string;
constructor(title:string, desc:string){
this.title = title;
this.description = desc;
};
}
}
User.ts
///<reference path="Company.ts"/>
module User {
export class Person {
public first:string;
public last:string;
private myJob:Company.Job;
private myAccount:User.Account;
constructor(firstName:string, lastName:string){
this.first = firstName;
this.last = lastName;
}
public getName():string{
return this.first + ' ' + this.last;
}
public setJob(job:Company.Job){
this.myJob = job;
}
public setAccount(acct:User.Account){
this.myAccount = acct;
}
public toString():string{
return "User: " + this.getName()
+ "\nUsername: " + this.myAccount.userName
+ "\nJob: " + this.myJob.title;
}
}
export class Account {
public userName:string;
private _password:string;
constructor(user:Person){
this.userName = user.first[0] + user.last;
this._password = '12345';
}
}
}
app.ts
///<reference path="src/User.ts"/>
///<reference path="src/Company.ts"/>
(function go(){
var user1:User.Person = new User.Person('Bill','Braxton');
var acct1:User.Account = new User.Account(user1);
var job1:Company.Job = new Company.Job('Greeter','Greet');
user1.setAccount(acct1);
user1.setJob(job1);
console.log(user1.toString());
}());
index.html
<!DOCTYPE html>
<html>
<head>
<title>TypeScript Test</title>
<script src="app.js"/>
<script>
go();
</script>
</head>
<body>
</body>
</html>
Compiler command
tsc --sourcemap --target ES5 --module commonjs file.ts
When I open index.html in Chrome and open the Sources panel Chrome Dev Tools, it will show me app.js and app.ts, but not the other .ts modules. So the source map for app.ts is working, but how do I load the other modules so they can be debugged in Chrome?