Нашел способ обойти это, сделал класс репозитория неабстрактным и удалил все инвертируемые аннотации.
В пакете / сервисе, который нуждался в классе репозитория, у меня есть помощник
import { Container } from 'inversify';
import { BaseSchema, MongoRepository } from 'some package';
import { Document } from 'mongoose';
export namespace DIHelper {
export function registerRepository<T extends Document>(container: Container, symbol: any, name: string, schema: BaseMongoSchema) {
container.bind(symbol)
.toDynamicValue((_ctx) => {
return new MongoRepository<T>(name, schema);
})
.inSingletonScope();
}
}
хранилище привязано к контейнеру как
import 'reflect-metadata';
import { Container } from 'inversify';
import { IUserAccount, UserAccountSchema } from '../../data/schemas/user-account';
import { IRole, RoleSchema } from '../../data/schemas/role';
import { IPolicy, PolicySchema } from '../../data/schemas/policy';
// Controllers
import '../controllers';
import { DIHelper } from '../helpers/di';
// Container
const DIContainer = new Container();
// Repository bindings
DIHelper.registerRepository<IUserAccount>(DIContainer, 'UserAccounts', 'UserAccount', UserAccountSchema);
DIHelper.registerRepository<IRole>(DIContainer, 'Roles', 'Role', RoleSchema);
DIHelper.registerRepository<IPolicy>(DIContainer, 'Policies', 'Policy', PolicySchema);
export default DIContainer;