I'm working in typescript 1.5 in visual studio. I have a main class called app.ts, and another called FizzBuzzManager.ts. I can't figure out what is wrong with this code, but it outputs the error, "TypeError: jim.FizzBuzzManager is not a constructor".
app.ts
namespace jim {
class Greeter {
element: HTMLElement;
span: HTMLElement;
timerToken: number;
constructor() {
window.console.log("constructing Greeter.");
this.init();
}
private init() {
window.console.log("Calling init.");
var _fizzBuzzManager: any = new jim.FizzBuzzManager();
}
}
window.onload = () => {
window.console.log("Hello")
var greeter = new Greeter();
};
FizzBuzzManager.ts
namespace jim {
export class FizzBuzzManager {
constructor() {
window.console.log("Making a FizzBuzzManager.");
}
public myThing: String = "Hi";
public fizzBuzz2() {
window.console.log("fizzbuzzing2 " + this.myThing);
}
}
export function fizzBuzz() {
window.console.log("export function fizzbuzz");
}
}
The output when looking at the compiled output in a browser is this:
Hello app.js:15:9
constructing Greeter. app.js:5:13
Calling init. app.js:9:13
TypeError: jim.FizzBuzzManager is not a constructor app.js:10:36
.jsfile used by your browser).