Cannot resolve ids of forwardRefs
sarathas opened this issue · comments
When a service has a forwardRef in its constructor, the id is undefined. Attempting to create a transactional service with a forwardRef results in an error when the id is scanned if it is a repository:
TypeError: Cannot read property 'includes' of undefined
at SomeService.getArgument (/path/to/application/node_modules/nest-transact/lib/with-transaction.ts:47:32)
//... rest of the stack trace
Example for a service with forwardRefs:
@Injectable()
export class SomeService extends TransactionFor<SomeService> {
constructor(
@InjectRepository(SomeRepository)
private readonly someRepository: SomeRepository,
@Inject(forwardRef(() => SomeOtherClass))
private someOtherClass: SomeOtherClass,
moduleRef: ModuleRef,
) {
super(moduleRef);
}
}
The object in this case is a ForwardReference
(provided by @nestjs/common
), so one could get the forwardRef
function of that object, execute it, and get the id by its name, for example.
Btw excluding the forwardRef does not work either as of right now, since the id is undefined.
@sarathas, Hi!
Please, check v.1.1.4, which has fixes for forwardRef from the community developer. I hope this version fix your problem. And... PRs are welcome!
It does, thank you! I hope I will find time to file a PR myself, should there be any further problems.
No, it not working