1
1
import {
2
- Type ,
3
2
isString ,
4
3
isBlank ,
5
4
isType ,
@@ -10,6 +9,7 @@ import {
10
9
normalizeBool ,
11
10
isArray
12
11
} from '../../facade/lang' ;
12
+ import { Type } from '../../facade/type' ;
13
13
import { reflector } from '../reflection/reflection' ;
14
14
import { OpaqueToken } from './opaque_token' ;
15
15
import {
@@ -31,7 +31,7 @@ import { isInjectMetadata } from './provider_util';
31
31
32
32
export type PropMetaInst = InputMetadata | OutputMetadata | HostBindingMetadata | HostListenerMetadata ;
33
33
export type ParamMetaInst = HostMetadata | InjectMetadata | SelfMetadata | SkipSelfMetadata ;
34
- export type ProviderType = Type | string | OpaqueToken ;
34
+ export type ProviderType = Type | OpaqueToken | Function | string ;
35
35
export type ProviderAliasOptions = { useClass ?: Type , useValue ?: any , useFactory ?: Function , deps ?: Object [ ] } ;
36
36
37
37
export class Provider {
@@ -219,7 +219,7 @@ class ProviderBuilder{
219
219
static createFromType (
220
220
type : ProviderType ,
221
221
{ useClass, useValue, useFactory, deps } : ProviderAliasOptions
222
- ) : [ string , Type ] {
222
+ ) : [ string , Type | Function ] {
223
223
224
224
// ...provide('myFactory',{useFactory: () => () => { return new Foo(); } })
225
225
if ( isPresent ( useFactory ) ) {
@@ -322,7 +322,7 @@ class ProviderBuilder{
322
322
export function provide (
323
323
type : ProviderType ,
324
324
{ useClass, useValue, useFactory, deps } : ProviderAliasOptions = { }
325
- ) : [ string , Type ] {
325
+ ) : [ string , Type | Function ] {
326
326
return ProviderBuilder . createFromType ( type , { useClass, useValue, useFactory, deps } ) ;
327
327
}
328
328
0 commit comments