Documentation is unclear where factory providers arguments are coming from
cowboyd opened this issue · 4 comments
Describe the bug
In this doc https://github.com/Urigo/graphql-modules/blob/master/website/docs/di/providers.md#factory
The factory has a dependency Config
which is used as a value, but then also used as a type in the argument of the factory. It's not clear what the value or the type is from the code examples. The prose explaining the code example do not explain what these values and types are.
Expected behavior
It should be clear what the values and types represent and where they are coming from.
Environment:
website
It actually comes from deps
;
useFactory(config: Config) {
if (config.environment === 'production') {
return 'my-api-key';
}
return null;
},
deps: [Config] // <<Here
Would you create a PR on the documentation to make it clear?
It is the injection token, class itself or custom injection token defined in providers
https://github.com/Urigo/graphql-modules/blob/master/website/docs/di/providers.md#defining-tokens
I see. It would probably benefit from having an import
statement to define the reference to the value in the docs.