tsyringe

export class RepositoryInjection<T extends ObjectLiteral> {
  public getRepository(): Repository<T> {
    return Container.resolve('UsersRepository') as any
  }
}

export class RepositoryTransform<T extends ObjectLiteral> implements Transform<RepositoryInjection<T>, Repository<T>> {
  public transform(flags: RepositoryInjection<T>): Repository<T> {
    return flags.getRepository()
  }
}
Restu Wahyu Saputra