Person.ts:
export class Person {
private _name: string;
constructor(name: string) {
this._name = name;
}
get name(): string {return this._name};
}
test.ts:
import {Person} from "./Person";
var user = new Person("John");
document.getElementById("h1").innerHTML = user.name;
tsconfig.json:
{
"compilerOptions": {
"target": "es5"
,"outDir" : "build"
}
}
When opening the result in Chrome, the following error is shown on the console:
Uncaught ReferenceError: exports is not defined
at test.js:2