Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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()
  }
}
 
PREVIOUS NEXT
Tagged: #tsyringe
ADD COMMENT
Topic
Name
2+7 =