import { EntityTarget, Repository } from "typeorm"
import { injectable, unmanaged, inject } from "inversify";
@injectable()
export abstract class RepositoryBase<T extends EntityBase> implements IRepository<T> {
protected _repository: Repository<T>;
protected _db: Database;
constructor(@unmanaged() entity: EntityTarget<T>, db: Database) {
this._db = db;
this._repository = this._db.getRepository(entity);
}
Build error:
Data/Repositories/RepositoryBase.ts:11:18 - error TS1239: Unable to resolve signature of parameter decorator when called as an expression.
Argument of type 'undefined' is not assignable to parameter of type 'string'.
11 constructor(@unmanaged() entity: EntityTarget<T>, db: Database) {
~~~~~~~~~~~
Found 1 error in Data/Repositories/RepositoryBase.ts:11
To save people looking around for a solution. The issue seems to be caused by Typescript 5, so you can downgrade Typescript.
A work around while waiting for the pull request would be to change the type:
Here is the your issue: https://github.com/inversify/InversifyJS/issues/1505
Here is a potential pull request: https://github.com/inversify/InversifyJS/pull/1499