I have a module file named 'class.ts' that exports a default class MyClass:
// class.ts
export default class MyClass {}
module.exports = MyClass // for importing in node.js withous require('./module').default
When I import this in Node.js, it works fine:
// class-user.js
const Class = require('./class')
const a = new Class() // This is working as expected
However, when I try to use this in TypeScript:
// class-user.ts
import Class from './class'
// The variable 'Class' becomes undefined
// But if I do:
import * as Class from './class'
const a = new Class()
// 'a' is an instance of the Class, but I get an error:
// [ts] Cannot use 'new' with an expression whose type lacks a call or construct signature.