I would like to :
./myClass/index.js
MyClass
somewhere
There is no export default class
in JavaScript. What you can do is write your JS file like this. myClass/index.js
"use strict";
class MyClass {
hello(name) {
console.log(`Hello ${name}`);
}
}
exports.default = MyClass;
Create a Type definitions for it. myClass/index.d.ts
export default class MyClass {
hello(name: string): void;
}
You can then import it into your TypeScript like this.
///
import MyClass from "./myClass";
const my = new MyClass();
my.hello("Stack Overflow");