Might be doing this wrong as I am new to typescript, but I have created a module, which I think from watching tutorials all day, let's me create what in C# would be a class, and I've done so like this:
export default class MyClass {
}
Now, it's my understanding that to create a new instance of this class, in typescript, I would do this:
import t from './MyClass';
var something = new t();
However, in my case my file is a js file, not a ts file, because I need to do it on the bottom of a html page.
However I can't figure out how, as doing new Myclass()
gives me a not defined error.
I am struggling with the concept of import and export despite watching several tutorials so I could be doing things wrong, but I just want to create a clean project and it has lead mt to believe this is the way to do that.
I should also add that I had to add my module like this:
<script type="module" src="~/Scripts/Proj/MyClass.js"></script>
I have never used type="module"
before, it just didn't work without it and I found it on a random SO post.
Any advice?