title: NestJS - Inject factory provider into another provider doesn't work
body: <p>I'm trying to use nest custom provider with factory, for some reason I'm struggling to get it working.
  I've created the following sample -</p>
  <pre><code>
  interface ProviderOptions: {x:string, y:number};
  interface AsyncProps {useFactory:(...args:any[])=&gt; ProviderOptions, inject:any[], imports:any[] }
  
  @Module({})
  export class MyModule {
      
     static forRootAsync(asyncProps: AsyncProps): DynamicModule {
          
       const myFactory: Provider = {
            provide: &quot;MY_PROVIDER&quot;,
            useFactory: asyncProps.useFactory,
            inject: asyncProps.inject,
          };
      
       return {
          module: MyModule,
          providers: [myFactory, MyService],
          exports: [MyService],
          imports: [...asyncProps.imports],
          };
      }
  }
  
  @Injectable()
  export class MyService {
  
     constructor(@Inject(&quot;MY_PROVIDER&quot;) this options:ProviderOptions){
  
     }
  }
  </code></pre>
  <p>For some reason I'm unable to resolve MyService -</p>
  <blockquote>
  <p>Error: Nest can't resolve dependencies of the MyService (?). Please
  make sure that the argument dependency at index [0] is available in
  the MyModule context.</p>
  </blockquote>
  <p>what I'm missing here?</p>
  <p>Thanks!</p>
  <p>UPDATE -
  so now it's really strange -
  originally MyService was in a different file, next to MyModule. when moved MyService to the same file as MyModule, the above code does work as expected. how can it be?</p>