понял почему не работает
import { Model } from 'sequelize/types';
import { internalError } from '../lib/errors';
export const findByPkOrFail = async <T extends typeof Model>(
model: T,
id?: string,
): Promise<T> => {
const doc = await model.findByPk(id);
if (!doc) {
throw internalError('Vote does not exist');
}
return doc;
};
Потому что метод findByPkOrFail может быть вызван только на объекте с типом ModelStatic
Обсуждают сегодня