Closed abhijeet1403 closed 5 years ago
Also if anyone can provide an ES6 version of the same documentation it'll be very helpful.
Because you have a circular imports, so MyModule is undefined in ModuleConfig
.
I can recommend you to use module names
@Injectable()
export class MyProvider {
constructor(@Inject(ModuleConfig('mymodule')) private config: MyModuleConfig) {
}
}
export const MyModule = new GraphQLModule<MyModuleConfig>({
name: 'my-module',
providers: () => [
MyProvider
]
});
I think we need to have a warning and documentation for this. I will keep this open until documentation and better error handling done.
I added the usage like below to ModuleConfig;
@Inject(ModuleConfig(module => MyModule))
You can try it with canary versions until we release a new version;
@graphql-modules/core
-> 0.7.0-alpha.c85943e2
It is available in 0.7.0.
(@Inject(ModuleConfig(MyModule) method in the Provider constructor is throwing an error.
Reproduction :
Just followed the steps mentioned at https://graphql-modules.com/docs/introduction/configuration
Issue: Either the documentation is incomplete or there's an issue with module configuration
my-provider.ts
my-module.ts
app.ts
Error: