File tree Expand file tree Collapse file tree
common/interfaces/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Scope } from '../scope-options.interface' ;
22import { Type } from '../type.interface' ;
33
4- export type Provider =
4+ export type Provider < T = any > =
55 | Type < any >
6- | ClassProvider
7- | ValueProvider
8- | FactoryProvider ;
6+ | ClassProvider < T >
7+ | ValueProvider < T >
8+ | FactoryProvider < T > ;
99
10- export interface ClassProvider {
11- provide : any ;
12- useClass : Type < any > ;
10+ export interface ClassProvider < T = any > {
11+ provide : string | symbol | Type < any > ;
12+ useClass : Type < T > ;
1313 scope ?: Scope ;
1414}
1515
16- export interface ValueProvider {
17- provide : any ;
18- useValue : any ;
16+ export interface ValueProvider < T = any > {
17+ provide : string | symbol | Type < any > ;
18+ useValue : T ;
1919}
2020
21- export interface FactoryProvider {
22- provide : any ;
23- useFactory : ( ...args : any [ ] ) => any ;
21+ export interface FactoryProvider < T = any > {
22+ provide : string | symbol | Type < any > ;
23+ useFactory : ( ...args : any [ ] ) => T ;
2424 inject ?: Array < Type < any > | string | any > ;
2525 scope ?: Scope ;
2626}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import { MetadataScanner } from './metadata-scanner';
3131interface ApplicationProviderWrapper {
3232 moduleKey : string ;
3333 providerKey : string ;
34- type : string ;
34+ type : string | symbol | Type < any > ;
3535}
3636
3737export class DependenciesScanner {
@@ -264,7 +264,7 @@ export class DependenciesScanner {
264264 const type = ( provider as ClassProvider | ValueProvider | FactoryProvider )
265265 . provide ;
266266
267- if ( ! providersKeys . includes ( type ) ) {
267+ if ( ! providersKeys . includes ( type as string ) ) {
268268 return this . container . addProvider ( provider as any , token ) ;
269269 }
270270 const providerToken = randomStringGenerator ( ) ;
@@ -319,7 +319,7 @@ export class DependenciesScanner {
319319 const { providers } = modules . get ( moduleKey ) ;
320320 const { instance } = providers . get ( providerKey ) ;
321321
322- applyProvidersMap [ type ] ( instance ) ;
322+ applyProvidersMap [ type as string ] ( instance ) ;
323323 } ,
324324 ) ;
325325 }
You can’t perform that action at this time.
0 commit comments