So I am trying to get into Nest for the first time, reading the docs and toying with the DI system to get my bearings. In my experimentation, I found myself in a rather confusing situation pretty much exactly like what is described here: https://github.com/nestjs/nest/issues/3856
Basically, I wrote a guard (call it G) which had a dependency on a provider (call it P). And I had a controller (C) in a different module (M2) which used that guard (but no explicit dependency on the provider used by the guard). And I was having a hard time figuring out how to inject that guard into a module with a controller that used it. Tried putting it in providers, but that only worked if I also included the guard's dependency in the providers even though my module (M2) had no explicit dependency on that. I eventually independently stumbled into a similar solution that @wet blade describes in the aforementioned issue, encapsulating the guard G in a module (M1) which exports it (and its dependency), and then importing that module in the other module (M2) where my controller needs it. But it was bothering me that I had to also export the implicit dependency (provider P) in order for G to work in M2, because this is not necessary for normal providers and I don't really understand why this situation requires different semantics for providers vs enhancers.
I think I might be missing something fundamental about how class-based enhancers are typically used and how they get instantiated for injection, so I'm looking for some technical clarification on why this approach (M1 w/ providers G & P must export P along with G) requires additionally exporting the implicitly depended-upon provider P when this is not necessary for injection of true 'providers'.