I have an abstract class Router:
export abstract class Router {
}
And an interface like this
interface IModule {
name: string;
forms: Array<IForm>,
route: typeof Router
}
Now I have a class which looks like this, and many others based on Router abstract
export class Module1 extends Router {
}
Now, I want to instantiate the route like this:
let module: IModule = {
name: "My Module",
forms: [],
route: Module1
}
let router = new module.route();
// TS2511: Cannot create an instance of an abstract class.
The code run just fine, and the instance of router = new Module1() is made properly, but I obviously doesn't write it properly in Typescript because I see TS2511: Cannot create an instance of an abstract class. when transpiling.
What is the correct way to define this?