Typescript does not recognize static methods of class

Viewed 32

I have a typescript function with a generic class named "Model". This class has a static method "build". Typescript does not recognize the static methods of the class and shows me this error. The compiled javasript does work without errors:

export function dataToInstance(model: Model, data: any) {
    if (!data) {
        return data;
    }

    const include = generateIncludeRecurse(model);
    const instance = model.build(data, { isNewRecord: false, raw: false, include });
    restoreTimestamps(data, instance);
    return instance;
}

Error: enter image description here

How can i get typescript to accept the static methods. I already tried "typeof" but then typescript throws errors because model is an abstract class.

0 Answers
Related