Typescript code:
export class GridObject {
constructor() {
alert("hello from GridObject constructor!");
}
}
var go = new GridObject();
I'm calling the compiled js from my HTML. When I remove "export", the alert shows up, and it doesn't when I have "export".
The following is the entire compiled js when using export
"use strict";
exports.__esModule = true;
var GridObject = /** @class */ (function () {
function GridObject() {
alert("hello from GridObject constructor!");
}
return GridObject;
}());
exports.GridObject = GridObject;
var go = new GridObject();
removing export from the TS removes the following 3 lines from the JS
"use strict";
exports.__esModule = true;
exports.GridObject = GridObject;
My HTML calls this script like this:
<script src="GridObject.js"></script>
I tried adding type="module" but that didn't work either.