fix(core): export provider interfaces that are part of the public API types (#31377)

Some of the provider interfaces that the [Provider][1] and
[StaticProvider][2] types comprise were not exported from
[@angular/core][3]. As a result, the docs for these symbols did not
appear on angular.io (even though both `Provider` and `StaticProvider`
are part of the public API. (See, also,
https://github.com/angular/angular/pull/31377#discussion_r299254408.)

This commit fixes it by exporting all necessary provider interfaces.

[1]: https://github.com/angular/angular/blob/9e34670b2/packages/core/src/di/interface/provider.ts#L365-L366
[2]: https://github.com/angular/angular/blob/9e34670b2/packages/core/src/di/interface/provider.ts#L283-L284
[3]: https://github.com/angular/angular/blob/9e34670b2/packages/core/src/di/index.ts#L23

PR Close #31377
This commit is contained in:
George Kalpakas 2019-07-02 23:57:02 +03:00 committed by Jason Aden
parent 4b05ebc804
commit 35f8bfce8b
3 changed files with 26 additions and 13 deletions

View File

@ -20,7 +20,7 @@ export {Injectable, InjectableDecorator, InjectableProvider} from './injectable'
export {Injector} from './injector'; export {Injector} from './injector';
export {ɵɵinject, inject, INJECTOR} from './injector_compatibility'; export {ɵɵinject, inject, INJECTOR} from './injector_compatibility';
export {ReflectiveInjector} from './reflective_injector'; export {ReflectiveInjector} from './reflective_injector';
export {StaticProvider, ValueProvider, ConstructorSansProvider, ExistingProvider, FactoryProvider, Provider, TypeProvider, ClassProvider, ValueSansProvider, ClassSansProvider} from './interface/provider'; export {ClassProvider, ClassSansProvider, ConstructorProvider, ConstructorSansProvider, ExistingProvider, ExistingSansProvider, FactoryProvider, FactorySansProvider, Provider, StaticClassProvider, StaticClassSansProvider, StaticProvider, TypeProvider, ValueProvider, ValueSansProvider} from './interface/provider';
export {ResolvedReflectiveFactory, ResolvedReflectiveProvider} from './reflective_provider'; export {ResolvedReflectiveFactory, ResolvedReflectiveProvider} from './reflective_provider';
export {ReflectiveKey} from './reflective_key'; export {ReflectiveKey} from './reflective_key';
export {InjectionToken} from './injection_token'; export {InjectionToken} from './injection_token';

View File

@ -164,12 +164,6 @@ export interface ConstructorProvider extends ConstructorSansProvider {
* *
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection). * For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
* *
* @usageNotes
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ExistingSansProvider'}
*
* @publicApi * @publicApi
*/ */
export interface ExistingSansProvider { export interface ExistingSansProvider {
@ -214,11 +208,6 @@ export interface ExistingProvider extends ExistingSansProvider {
* *
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection). * For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
* *
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='FactorySansProvider'}
*
* @publicApi * @publicApi
*/ */
export interface FactorySansProvider { export interface FactorySansProvider {

View File

@ -165,6 +165,11 @@ export declare abstract class ComponentRef<C> {
abstract onDestroy(callback: Function): void; abstract onDestroy(callback: Function): void;
} }
export interface ConstructorProvider extends ConstructorSansProvider {
multi?: boolean;
provide: Type<any>;
}
export interface ConstructorSansProvider { export interface ConstructorSansProvider {
deps?: any[]; deps?: any[];
} }
@ -332,11 +337,20 @@ export interface ExistingProvider extends ExistingSansProvider {
provide: any; provide: any;
} }
export interface ExistingSansProvider {
useExisting: any;
}
export interface FactoryProvider extends FactorySansProvider { export interface FactoryProvider extends FactorySansProvider {
multi?: boolean; multi?: boolean;
provide: any; provide: any;
} }
export interface FactorySansProvider {
deps?: any[];
useFactory: Function;
}
export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>; export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>;
export interface ForwardRefFn { export interface ForwardRefFn {
@ -1345,6 +1359,16 @@ export interface SkipSelfDecorator {
new (): SkipSelf; new (): SkipSelf;
} }
export interface StaticClassProvider extends StaticClassSansProvider {
multi?: boolean;
provide: any;
}
export interface StaticClassSansProvider {
deps: any[];
useClass: Type<any>;
}
export declare type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider | ConstructorProvider | FactoryProvider | any[]; export declare type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvider | ConstructorProvider | FactoryProvider | any[];
/** @deprecated */ /** @deprecated */