chore: update public api

Closes #10355
This commit is contained in:
Tobias Bosch 2016-07-29 04:19:02 -07:00
parent d0a95e35af
commit 0eca7abdd8
2 changed files with 122 additions and 271 deletions

View File

@ -237,11 +237,12 @@ export declare class CollectionChangeRecord {
/** @stable */ /** @stable */
export declare class Compiler { export declare class Compiler {
_injector: Injector;
clearCache(): void; clearCache(): void;
clearCacheFor(type: Type): void; clearCacheFor(type: Type): void;
compileComponentAsync<T>(component: ConcreteType<T>, ngModule?: Type): Promise<ComponentFactory<T>>; compileComponentAsync<T>(component: ConcreteType<T>, ngModule?: Type): Promise<ComponentFactory<T>>;
compileComponentSync<T>(component: ConcreteType<T>, ngModule?: Type): ComponentFactory<T>; compileComponentSync<T>(component: ConcreteType<T>, ngModule?: Type): ComponentFactory<T>;
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>): Promise<ModuleWithComponentFactories<T>>;
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>): ModuleWithComponentFactories<T>;
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>>; compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>>;
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T>; compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T>;
} }
@ -259,17 +260,6 @@ export declare var Component: ComponentMetadataFactory;
/** @stable */ /** @stable */
export interface ComponentDecorator extends TypeDecorator { export interface ComponentDecorator extends TypeDecorator {
View(obj: {
templateUrl?: string;
template?: string;
directives?: Array<Type | any[]>;
pipes?: Array<Type | any[]>;
renderer?: string;
styles?: string[];
styleUrls?: string[];
animations?: AnimationEntryMetadata[];
interpolation?: [string, string];
}): ViewDecorator;
} }
/** @stable */ /** @stable */
@ -287,7 +277,7 @@ export declare abstract class ComponentFactoryResolver {
} }
/** @stable */ /** @stable */
export declare class ComponentMetadata extends DirectiveMetadata { export declare class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType {
animations: AnimationEntryMetadata[]; animations: AnimationEntryMetadata[];
changeDetection: ChangeDetectionStrategy; changeDetection: ChangeDetectionStrategy;
directives: Array<Type | any[]>; directives: Array<Type | any[]>;
@ -301,93 +291,30 @@ export declare class ComponentMetadata extends DirectiveMetadata {
template: string; template: string;
templateUrl: string; templateUrl: string;
viewProviders: any[]; viewProviders: any[];
constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId, providers, viewProviders, changeDetection, queries, templateUrl, template, styleUrls, styles, animations, directives, pipes, encapsulation, interpolation, precompile, entryComponents}?: { constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId, providers, viewProviders, changeDetection, queries, templateUrl, template, styleUrls, styles, animations, directives, pipes, encapsulation, interpolation, entryComponents}?: ComponentMetadataType);
selector?: string;
inputs?: string[];
outputs?: string[]; properties?: string[]; events?: string[];
host?: {
[key: string]: string;
};
providers?: any[];
exportAs?: string;
moduleId?: string;
viewProviders?: any[];
queries?: {
[key: string]: any;
};
changeDetection?: ChangeDetectionStrategy;
templateUrl?: string;
template?: string;
styleUrls?: string[];
styles?: string[];
animations?: AnimationEntryMetadata[];
directives?: Array<Type | any[]>;
pipes?: Array<Type | any[]>;
encapsulation?: ViewEncapsulation;
interpolation?: [string, string];
precompile?: Array<Type | any[]>;
entryComponents?: Array<Type | any[]>;
});
} }
/** @stable */ /** @stable */
export interface ComponentMetadataFactory { export interface ComponentMetadataFactory {
(obj: { (obj: ComponentMetadataType): ComponentDecorator;
selector?: string; new (obj: ComponentMetadataType): ComponentMetadata;
inputs?: string[]; }
outputs?: string[];
properties?: string[]; /** @experimental */
events?: string[]; export interface ComponentMetadataType extends DirectiveMetadataType {
host?: { animations?: AnimationEntryMetadata[];
[key: string]: string; changeDetection?: ChangeDetectionStrategy;
}; directives?: Array<Type | any[]>;
providers?: any[]; encapsulation?: ViewEncapsulation;
exportAs?: string; entryComponents?: Array<Type | any[]>;
moduleId?: string; interpolation?: [string, string];
queries?: { moduleId?: string;
[key: string]: any; pipes?: Array<Type | any[]>;
}; styleUrls?: string[];
viewProviders?: any[]; styles?: string[];
changeDetection?: ChangeDetectionStrategy; template?: string;
templateUrl?: string; templateUrl?: string;
template?: string; viewProviders?: any[];
styleUrls?: string[];
styles?: string[];
animations?: AnimationEntryMetadata[];
directives?: Array<Type | any[]>;
pipes?: Array<Type | any[]>;
encapsulation?: ViewEncapsulation;
interpolation?: [string, string];
entryComponents?: Array<Type | any[]>;
}): ComponentDecorator;
new (obj: {
selector?: string;
inputs?: string[];
outputs?: string[];
properties?: string[];
events?: string[];
host?: {
[key: string]: string;
};
providers?: any[];
exportAs?: string;
moduleId?: string;
queries?: {
[key: string]: any;
};
viewProviders?: any[];
changeDetection?: ChangeDetectionStrategy;
templateUrl?: string;
template?: string;
styleUrls?: string[];
styles?: string[];
animations?: AnimationEntryMetadata[];
directives?: Array<Type | any[]>;
pipes?: Array<Type | any[]>;
encapsulation?: ViewEncapsulation;
interpolation?: [string, string];
entryComponents?: Array<Type | any[]>;
}): ComponentMetadata;
} }
/** @stable */ /** @stable */
@ -550,7 +477,7 @@ export interface DirectiveDecorator extends TypeDecorator {
} }
/** @stable */ /** @stable */
export declare class DirectiveMetadata extends InjectableMetadata { export declare class DirectiveMetadata extends InjectableMetadata implements DirectiveMetadataType {
/** @deprecated */ events: string[]; /** @deprecated */ events: string[];
exportAs: string; exportAs: string;
host: { host: {
@ -564,53 +491,30 @@ export declare class DirectiveMetadata extends InjectableMetadata {
[key: string]: any; [key: string]: any;
}; };
selector: string; selector: string;
constructor({selector, inputs, outputs, properties, events, host, providers, exportAs, queries}?: { constructor({selector, inputs, outputs, properties, events, host, providers, exportAs, queries}?: DirectiveMetadataType);
selector?: string;
inputs?: string[];
outputs?: string[]; properties?: string[]; events?: string[];
host?: {
[key: string]: string;
};
providers?: any[];
exportAs?: string;
queries?: {
[key: string]: any;
};
});
} }
/** @stable */ /** @stable */
export interface DirectiveMetadataFactory { export interface DirectiveMetadataFactory {
(obj: { (obj: DirectiveMetadataType): DirectiveDecorator;
selector?: string; new (obj: DirectiveMetadataType): DirectiveMetadata;
inputs?: string[]; }
outputs?: string[];
properties?: string[]; /** @experimental */
events?: string[]; export interface DirectiveMetadataType {
host?: { events?: string[];
[key: string]: string; exportAs?: string;
}; host?: {
providers?: any[]; [key: string]: string;
exportAs?: string; };
queries?: { inputs?: string[];
[key: string]: any; outputs?: string[];
}; properties?: string[];
}): DirectiveDecorator; providers?: any[];
new (obj: { queries?: {
selector?: string; [key: string]: any;
inputs?: string[]; };
outputs?: string[]; selector?: string;
properties?: string[];
events?: string[];
host?: {
[key: string]: string;
};
providers?: any[];
exportAs?: string;
queries?: {
[key: string]: any;
};
}): DirectiveMetadata;
} }
/** @experimental */ /** @experimental */
@ -859,6 +763,13 @@ export declare class KeyValueDiffers {
/** @deprecated */ /** @deprecated */
export declare function lockRunMode(): void; export declare function lockRunMode(): void;
/** @experimental */
export declare class ModuleWithComponentFactories<T> {
componentFactories: ComponentFactory<any>[];
ngModuleFactory: NgModuleFactory<T>;
constructor(ngModuleFactory: NgModuleFactory<T>, componentFactories: ComponentFactory<any>[]);
}
/** @experimental */ /** @experimental */
export interface ModuleWithProviders { export interface ModuleWithProviders {
ngModule: Type; ngModule: Type;
@ -887,41 +798,30 @@ export declare abstract class NgModuleFactoryLoader {
} }
/** @experimental */ /** @experimental */
export declare class NgModuleMetadata extends InjectableMetadata { export declare class NgModuleMetadata extends InjectableMetadata implements NgModuleMetadataType {
declarations: Array<Type | any[]>; declarations: Array<Type | any[]>;
entryComponents: Array<Type | any[]>; entryComponents: Array<Type | any[]>;
exports: Array<Type | any[]>; exports: Array<Type | any[]>;
imports: Array<Type | ModuleWithProviders | any[]>; imports: Array<Type | ModuleWithProviders | any[]>;
providers: any[]; providers: any[];
schemas: Array<SchemaMetadata | any[]>; schemas: Array<SchemaMetadata | any[]>;
constructor({providers, declarations, imports, exports, entryComponents, schemas}?: { constructor({providers, declarations, imports, exports, entryComponents, schemas}?: NgModuleMetadataType);
providers?: any[];
declarations?: Array<Type | any[]>;
imports?: Array<Type | any[]>;
exports?: Array<Type | any[]>;
entryComponents?: Array<Type | any[]>;
schemas?: Array<SchemaMetadata | any[]>;
});
} }
/** @experimental */ /** @experimental */
export interface NgModuleMetadataFactory { export interface NgModuleMetadataFactory {
(obj?: { (obj?: NgModuleMetadataType): NgModuleDecorator;
providers?: any[]; new (obj?: NgModuleMetadataType): NgModuleMetadata;
declarations?: Array<Type | any[]>; }
imports?: Array<Type | ModuleWithProviders | any[]>;
exports?: Array<Type | any[]>; /** @experimental */
entryComponents?: Array<Type | any[]>; export interface NgModuleMetadataType {
schemas?: Array<SchemaMetadata | any[]>; declarations?: Array<Type | any[]>;
}): NgModuleDecorator; entryComponents?: Array<Type | any[]>;
new (obj?: { exports?: Array<Type | any[]>;
providers?: any[]; imports?: Array<Type | ModuleWithProviders | any[]>;
declarations?: Array<Type | any[]>; providers?: any[];
imports?: Array<Type | any[]>; schemas?: Array<SchemaMetadata | any[]>;
exports?: Array<Type | any[]>;
entryComponents?: Array<Type | any[]>;
schemas?: Array<SchemaMetadata | any[]>;
}): NgModuleMetadata;
} }
/** @experimental */ /** @experimental */
@ -1036,25 +936,22 @@ export declare const PACKAGE_ROOT_URL: any;
export declare var Pipe: PipeMetadataFactory; export declare var Pipe: PipeMetadataFactory;
/** @stable */ /** @stable */
export declare class PipeMetadata extends InjectableMetadata { export declare class PipeMetadata extends InjectableMetadata implements PipeMetadataType {
name: string; name: string;
pure: boolean; pure: boolean;
constructor({name, pure}: { constructor({name, pure}: PipeMetadataType);
name: string;
pure?: boolean;
});
} }
/** @stable */ /** @stable */
export interface PipeMetadataFactory { export interface PipeMetadataFactory {
(obj: { (obj: PipeMetadataType): any;
name: string; new (obj: PipeMetadataType): any;
pure?: boolean; }
}): any;
new (obj: { /** @experimental */
name: string; export interface PipeMetadataType {
pure?: boolean; name: string;
}): any; pure?: boolean;
} }
/** @stable */ /** @stable */
@ -1476,21 +1373,6 @@ export declare abstract class ViewContainerRef {
abstract remove(index?: number): void; abstract remove(index?: number): void;
} }
/** @experimental */
export interface ViewDecorator extends TypeDecorator {
View(obj: {
templateUrl?: string;
template?: string;
directives?: Array<Type | any[]>;
pipes?: Array<Type | any[]>;
renderer?: string;
styles?: string[];
styleUrls?: string[];
animations?: AnimationEntryMetadata[];
interpolation?: [string, string];
}): ViewDecorator;
}
/** @stable */ /** @stable */
export declare enum ViewEncapsulation { export declare enum ViewEncapsulation {
Emulated = 0, Emulated = 0,
@ -1498,7 +1380,7 @@ export declare enum ViewEncapsulation {
None = 2, None = 2,
} }
/** @experimental */ /** @deprecated */
export declare class ViewMetadata { export declare class ViewMetadata {
animations: AnimationEntryMetadata[]; animations: AnimationEntryMetadata[];
directives: Array<Type | any[]>; directives: Array<Type | any[]>;
@ -1522,32 +1404,6 @@ export declare class ViewMetadata {
}); });
} }
/** @experimental */
export interface ViewMetadataFactory {
(obj: {
templateUrl?: string;
template?: string;
directives?: Array<Type | any[]>;
pipes?: Array<Type | any[]>;
encapsulation?: ViewEncapsulation;
styles?: string[];
styleUrls?: string[];
animations?: AnimationEntryMetadata[];
interpolation?: [string, string];
}): ViewDecorator;
new (obj: {
templateUrl?: string;
template?: string;
directives?: Array<Type | any[]>;
pipes?: Array<Type | any[]>;
encapsulation?: ViewEncapsulation;
styles?: string[];
styleUrls?: string[];
animations?: AnimationEntryMetadata[];
interpolation?: [string, string];
}): ViewMetadata;
}
/** @deprecated */ /** @deprecated */
export declare var ViewQuery: QueryMetadataFactory; export declare var ViewQuery: QueryMetadataFactory;

View File

@ -1,4 +1,4 @@
/** @stable */ /** @deprecated */
export declare function addProviders(providers: Array<any>): void; export declare function addProviders(providers: Array<any>): void;
/** @stable */ /** @stable */
@ -28,27 +28,9 @@ export declare var ComponentFixtureAutoDetect: OpaqueToken;
/** @experimental */ /** @experimental */
export declare var ComponentFixtureNoNgZone: OpaqueToken; export declare var ComponentFixtureNoNgZone: OpaqueToken;
/** @stable */
export declare function configureCompiler(config: {
providers?: any[];
useJit?: boolean;
}): void;
/** @stable */
export declare function configureModule(moduleDef: {
providers?: any[];
declarations?: any[];
imports?: any[];
entryComponents?: any[];
schemas?: Array<SchemaMetadata | any[]>;
}): void;
/** @experimental */ /** @experimental */
export declare function discardPeriodicTasks(): void; export declare function discardPeriodicTasks(): void;
/** @experimental */
export declare function doAsyncEntryPointCompilation(): Promise<any>;
/** @experimental */ /** @experimental */
export declare function fakeAsync(fn: Function): (...args: any[]) => any; export declare function fakeAsync(fn: Function): (...args: any[]) => any;
@ -61,29 +43,25 @@ export declare function getTestBed(): TestBed;
/** @deprecated */ /** @deprecated */
export declare function getTestInjector(): TestBed; export declare function getTestInjector(): TestBed;
/** @experimental */
export declare function initTestEnvironment(ngModule: Type, platform: PlatformRef): Injector;
/** @stable */ /** @stable */
export declare function inject(tokens: any[], fn: Function): () => any; export declare function inject(tokens: any[], fn: Function): () => any;
/** @experimental */ /** @experimental */
export declare class InjectSetupWrapper { export declare class InjectSetupWrapper {
constructor(_moduleDef: () => { constructor(_moduleDef: () => TestModuleMetadata);
providers?: any[];
declarations?: any[];
imports?: any[];
entryComponents?: any[];
});
inject(tokens: any[], fn: Function): () => any; inject(tokens: any[], fn: Function): () => any;
} }
/** @experimental */
export declare type MetadataOverride<T> = {
add?: T;
remove?: T;
set?: T;
};
/** @deprecated */ /** @deprecated */
export declare function resetBaseTestProviders(): void; export declare function resetBaseTestProviders(): void;
/** @experimental */
export declare function resetTestEnvironment(): void;
/** @deprecated */ /** @deprecated */
export declare function setBaseTestProviders(platformProviders: Array<Type | Provider | any[]>, applicationProviders: Array<Type | Provider | any[]>): void; export declare function setBaseTestProviders(platformProviders: Array<Type | Provider | any[]>, applicationProviders: Array<Type | Provider | any[]>): void;
@ -91,32 +69,47 @@ export declare function setBaseTestProviders(platformProviders: Array<Type | Pro
export declare class TestBed implements Injector { export declare class TestBed implements Injector {
ngModule: Type; ngModule: Type;
platform: PlatformRef; platform: PlatformRef;
compileComponents(): Promise<any>;
configureCompiler(config: { configureCompiler(config: {
providers?: any[]; providers?: any[];
useJit?: boolean; useJit?: boolean;
}): void; }): void;
configureModule(moduleDef: { configureTestingModule(moduleDef: TestModuleMetadata): void;
providers?: any[]; createComponent<T>(component: ConcreteType<T>): ComponentFixture<T>;
declarations?: any[];
imports?: any[];
entryComponents?: any[];
schemas?: Array<SchemaMetadata | any>;
}): void;
createModuleFactory(): Promise<NgModuleFactory<any>>;
execute(tokens: any[], fn: Function): any; execute(tokens: any[], fn: Function): any;
get(token: any, notFoundValue?: any): any; get(token: any, notFoundValue?: any): any;
initTestModule(): void; /** @experimental */ initTestEnvironment(ngModule: Type, platform: PlatformRef): void;
reset(): void; overrideComponent(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): void;
overrideDirective(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): void;
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>): void;
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): void;
/** @deprecated */ reset(): void;
/** @experimental */ resetTestEnvironment(): void;
resetTestingModule(): void;
static compileComponents(): Promise<any>;
static configureCompiler(config: {
providers?: any[];
useJit?: boolean;
}): typeof TestBed;
static configureTestingModule(moduleDef: TestModuleMetadata): typeof TestBed;
static createComponent<T>(component: ConcreteType<T>): ComponentFixture<T>;
/** @experimental */ static initTestEnvironment(ngModule: Type, platform: PlatformRef): TestBed;
static overrideComponent(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): typeof TestBed;
static overrideDirective(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): typeof TestBed;
static overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>): typeof TestBed;
static overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): typeof TestBed;
/** @experimental */ static resetTestEnvironment(): void;
static resetTestingModule(): typeof TestBed;
} }
/** @stable */ /** @deprecated */
export declare class TestComponentBuilder { export declare class TestComponentBuilder {
protected _injector: Injector; protected _injector: Injector;
constructor(_injector: Injector); constructor(_injector: Injector);
createAsync<T>(rootComponentType: ConcreteType<T>, ngModule?: ConcreteType<any>): Promise<ComponentFixture<T>>; createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>>;
createFakeAsync<T>(rootComponentType: ConcreteType<T>, ngModule?: ConcreteType<any>): ComponentFixture<T>; createFakeAsync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T>;
protected createFromFactory<C>(ngZone: NgZone, componentFactory: ComponentFactory<C>): ComponentFixture<C>; protected createFromFactory<C>(ngZone: NgZone, componentFactory: ComponentFactory<C>): ComponentFixture<C>;
createSync<T>(rootComponentType: ConcreteType<T>, ngModule?: ConcreteType<any>): ComponentFixture<T>; createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T>;
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]): TestComponentBuilder; overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]): TestComponentBuilder;
overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder; overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder;
overrideProviders(type: Type, providers: any[]): TestComponentBuilder; overrideProviders(type: Type, providers: any[]): TestComponentBuilder;
@ -131,16 +124,18 @@ export declare class TestComponentRenderer {
} }
/** @experimental */ /** @experimental */
export declare function tick(millis?: number): void; export declare type TestModuleMetadata = {
/** @experimental */
export declare function withModule(moduleDef: () => {
providers?: any[]; providers?: any[];
declarations?: any[]; declarations?: any[];
imports?: any[]; imports?: any[];
entryComponents?: any[];
schemas?: Array<SchemaMetadata | any[]>; schemas?: Array<SchemaMetadata | any[]>;
}): InjectSetupWrapper; };
/** @experimental */ /** @experimental */
export declare function tick(millis?: number): void;
/** @experimental */
export declare function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper;
/** @deprecated */
export declare function withProviders(providers: () => any): InjectSetupWrapper; export declare function withProviders(providers: () => any): InjectSetupWrapper;