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 {ɵɵinject, inject, INJECTOR} from './injector_compatibility';
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 {ReflectiveKey} from './reflective_key';
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).
*
* @usageNotes
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ExistingSansProvider'}
*
* @publicApi
*/
export interface ExistingSansProvider {
@ -214,11 +208,6 @@ export interface ExistingProvider extends ExistingSansProvider {
*
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
*
* @usageNotes
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='FactorySansProvider'}
*
* @publicApi
*/
export interface FactorySansProvider {
@ -369,4 +358,4 @@ export type Provider = TypeProvider | ValueProvider | ClassProvider | Constructo
* Describes a function that is used to process provider list (for example in case of provider
* overrides).
*/
export type ProcessProvidersFunction = (providers: Provider[]) => Provider[];
export type ProcessProvidersFunction = (providers: Provider[]) => Provider[];

View File

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