Feature(typing): Export TranslocoOptions type
scurk1415 opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Which Transloco package(s) will this feature affect?
Transloco
Is your feature request related to a problem? Please describe
I would like to have the TranslocoOptions in a separate file, to not clutter the providers/module. With the module approach its not such a big problem as you create a separate module which you import in the AppModule, but with standalone the config takes too much space in the app.config.ts file.
Something like this:
export const appConfig: ApplicationConfig = {
providers: [
provideTransloco(importedConfigObject)
]
};
Describe the solution you'd like
export type TranslocoOptions = {
config: PartialTranslocoConfig;
loader?: Type<TranslocoLoader>;
};
Describe alternatives you've considered
I think the described solution is acceptable
Additional context
No response
I would like to make a pull request for this feature
No
@scurk1415 If you would like to be able to use the TranslocoOptions
type, you can get it using TypeScript based on the parameters of the provideTransloco
method.
type TranslocoOptions = Parameters<typeof provideTransloco>[0]
const myConfig: TranslocoOptions = {
config: {},
loader: TranslocoHttpLoader
}
I'll export the options, but @greenjellygit's solution is a valid and clean one, you can use it.