I have a problem with executing code in transaction using my repository
In typeorm 0.2 I had a piece of code with transaction where I could load custom repository via method
getCustomRepository
in version 0.3 this method is deprecated and also in nest js
@EntityRepository
decorator is deprecated
according to docs
https://orkhan.gitbook.io/typeorm/docs/custom-repository
we should use withRepository orextend method
await connection.transaction(async (manager) => {
const userRepository = manager.withRepository(UserRepository)
await userRepository.createAndSave("Timber", "Saw")
const timber = await userRepository.findByName("Timber", "Saw")
})
but withRepository method expect different arguments that specified in docs
Argument of type 'typeof UserRepository' is not assignable to parameter of type 'Repository<any> & Repository<ObjectLiteral>'