Pass by parameter a class with type assertion - Typescript

377 Views Asked by At

I'm simulating a multiple inheritance in typescript by this way:

export const FileManager = superClass => class extends superClass {
    //...
}

export declare abstract class Model<T extends Model<T>>{
//...
}

I tried the following and then it says that FileManager was expecting 1 parameter instead of 2.

export class Order extends FileManager(Model<Order>)){
//...
}

So I changed the FileManager definition to:

export const FileManager = (superClass,t) => class extends superClass<t> {
    //...
}

But then I get this error:

[ts] Value of type 'typeof Model' is not callable. Did you mean to include 'new'?

It was working well before I needed to declare the Type Assertion to model class (its neccesary, I cant remove it). I think the problem is the way I receive the 'typeof' as parameter and how to instantiate dynamically.

Im really stuck, I will be very grateful to any help

0

There are 0 best solutions below