Skip to content
Permalink
Browse files

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,
#31377 (comment).)

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
  • Loading branch information...
gkalpak authored and jasonaden committed Jul 2, 2019
1 parent 7b0a287 commit bebf089046784e9e63131da3211f0a835cfea07f
Showing with 26 additions and 13 deletions.
  1. +1 −1 packages/core/src/di/index.ts
  2. +1 −12 packages/core/src/di/interface/provider.ts
  3. +24 −0 tools/public_api_guard/core/core.d.ts
@@ -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';
@@ -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[];
@@ -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 {
@@ -1327,6 +1341,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 */

0 comments on commit bebf089

Please sign in to comment.
You can’t perform that action at this time.