refactor(Type): merge Type and ConcreType<?> into Type<?> (#10616)
Closes #9729 BREAKING CHANGE: `Type` is now `Type<T>` which means that in most cases you have to use `Type<any>` in place of `Type`. We don't expect that any user applications use the `Type` type.
This commit is contained in:
parent
6f4ee6101c
commit
b96869afd2
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '@angular/core';
|
||||
import {Provider} from '@angular/core';
|
||||
|
||||
import {CORE_DIRECTIVES} from './directives';
|
||||
|
||||
|
@ -55,4 +55,4 @@ import {CORE_DIRECTIVES} from './directives';
|
|||
*
|
||||
* @experimental Contains forms which are experimental.
|
||||
*/
|
||||
export const COMMON_DIRECTIVES: Type[][] = [CORE_DIRECTIVES];
|
||||
export const COMMON_DIRECTIVES: any[] = CORE_DIRECTIVES;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../facade/lang';
|
||||
import {Type} from '@angular/core';
|
||||
|
||||
import {NgClass} from './ng_class';
|
||||
import {NgFor} from './ng_for';
|
||||
|
@ -58,7 +58,7 @@ import {NgTemplateOutlet} from './ng_template_outlet';
|
|||
*
|
||||
* @stable
|
||||
*/
|
||||
export const CORE_DIRECTIVES: Type[] = [
|
||||
export const CORE_DIRECTIVES: Type<any>[] = [
|
||||
NgClass,
|
||||
NgFor,
|
||||
NgIf,
|
||||
|
|
|
@ -57,7 +57,7 @@ export {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from './forms-deprecated
|
|||
*
|
||||
* @experimental
|
||||
*/
|
||||
export const FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry];
|
||||
export const FORM_PROVIDERS: Type<any>[] = [FormBuilder, RadioControlRegistry];
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@ export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValida
|
|||
* ```
|
||||
* @experimental
|
||||
*/
|
||||
export const FORM_DIRECTIVES: Type[] = [
|
||||
export const FORM_DIRECTIVES: Type<any>[] = [
|
||||
NgControlName,
|
||||
NgControlGroup,
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
import {Type, stringify} from '../facade/lang';
|
||||
import {BaseException, Type} from '@angular/core';
|
||||
import {stringify} from '../facade/lang';
|
||||
|
||||
export class InvalidPipeArgumentException extends BaseException {
|
||||
constructor(type: Type, value: Object) {
|
||||
constructor(type: Type<any>, value: Object) {
|
||||
super(`Invalid argument '${value}' for pipe '${stringify(type)}'`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import {Pipe, PipeTransform, Type} from '@angular/core';
|
||||
|
||||
import {NumberFormatStyle, NumberFormatter} from '../facade/intl';
|
||||
import {NumberWrapper, Type, isBlank, isNumber, isPresent, isString} from '../facade/lang';
|
||||
import {NumberWrapper, isBlank, isNumber, isPresent, isString} from '../facade/lang';
|
||||
|
||||
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception';
|
||||
|
||||
|
@ -17,7 +17,7 @@ var defaultLocale: string = 'en-US';
|
|||
const _NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(\-(\d+))?)?$/;
|
||||
|
||||
function formatNumber(
|
||||
pipe: Type, value: number | string, style: NumberFormatStyle, digits: string,
|
||||
pipe: Type<any>, value: number | string, style: NumberFormatStyle, digits: string,
|
||||
currency: string = null, currencyAsSymbol: boolean = false): string {
|
||||
if (isBlank(value)) return null;
|
||||
// Convert strings to numbers
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ChangeDetectionStrategy, SchemaMetadata, ViewEncapsulation} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, SchemaMetadata, Type, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
import {LifecycleHooks, reflector} from '../core_private';
|
||||
|
||||
import {ListWrapper, StringMapWrapper} from './facade/collection';
|
||||
import {BaseException, unimplemented} from './facade/exceptions';
|
||||
import {Type, isBlank, isPresent, isStringMap, normalizeBlank, normalizeBool} from './facade/lang';
|
||||
|
||||
import {isBlank, isPresent, isStringMap, normalizeBlank, normalizeBool} from './facade/lang';
|
||||
import {CssSelector} from './selector';
|
||||
import {getUrlScheme} from './url_resolver';
|
||||
import {sanitizeIdentifier, splitAtColon} from './util';
|
||||
|
@ -308,7 +308,7 @@ export class CompileTypeMetadata extends CompileIdentifierMetadata {
|
|||
lifecycleHooks: LifecycleHooks[];
|
||||
|
||||
constructor({runtime, name, moduleUrl, prefix, isHost, value, diDeps, lifecycleHooks}: {
|
||||
runtime?: Type,
|
||||
runtime?: Type<any>,
|
||||
name?: string,
|
||||
moduleUrl?: string,
|
||||
prefix?: string,
|
||||
|
@ -685,8 +685,8 @@ export class CompileNgModuleMetadata implements CompileMetadataWithIdentifier {
|
|||
}
|
||||
|
||||
export class TransitiveCompileNgModuleMetadata {
|
||||
directivesSet = new Set<Type>();
|
||||
pipesSet = new Set<Type>();
|
||||
directivesSet = new Set<Type<any>>();
|
||||
pipesSet = new Set<Type<any>>();
|
||||
constructor(
|
||||
public modules: CompileNgModuleMetadata[], public providers: CompileProviderMetadata[],
|
||||
public entryComponents: CompileTypeMetadata[], public directives: CompileDirectiveMetadata[],
|
||||
|
|
|
@ -52,7 +52,7 @@ const _NO_XHR: XHR = {
|
|||
* A set of providers that provide `RuntimeCompiler` and its dependencies to use for
|
||||
* template compilation.
|
||||
*/
|
||||
export const COMPILER_PROVIDERS: Array<any|Type|{[k: string]: any}|any[]> = [
|
||||
export const COMPILER_PROVIDERS: Array<any|Type<any>|{[k: string]: any}|any[]> = [
|
||||
{provide: Reflector, useValue: reflector},
|
||||
{provide: ReflectorReader, useExisting: Reflector},
|
||||
{provide: XHR, useValue: _NO_XHR},
|
||||
|
@ -79,8 +79,11 @@ export const COMPILER_PROVIDERS: Array<any|Type|{[k: string]: any}|any[]> = [
|
|||
];
|
||||
|
||||
|
||||
export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[] = []):
|
||||
{compilerOptions: CompilerOptions, moduleDeclarations: Type[], deprecationMessages: string[]} {
|
||||
export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[] = []): {
|
||||
compilerOptions: CompilerOptions,
|
||||
moduleDeclarations: Type<any>[],
|
||||
deprecationMessages: string[]
|
||||
} {
|
||||
let platformDirectives: any[] = [];
|
||||
let platformPipes: any[] = [];
|
||||
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException, ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, Injectable, InputMetadata, OutputMetadata, QueryMetadata, resolveForwardRef} from '@angular/core';
|
||||
|
||||
import {ComponentMetadata, DirectiveMetadata, HostBindingMetadata, HostListenerMetadata, Injectable, InputMetadata, OutputMetadata, QueryMetadata, Type, resolveForwardRef} from '@angular/core';
|
||||
import {ReflectorReader, reflector} from '../core_private';
|
||||
|
||||
import {StringMapWrapper} from './facade/collection';
|
||||
import {Type, isPresent, stringify} from './facade/lang';
|
||||
import {BaseException} from './facade/exceptions';
|
||||
import {isPresent, stringify} from './facade/lang';
|
||||
import {splitAtColon} from './util';
|
||||
|
||||
function _isDirectiveMetadata(type: any): type is DirectiveMetadata {
|
||||
|
@ -32,7 +31,7 @@ export class DirectiveResolver {
|
|||
/**
|
||||
* Return {@link DirectiveMetadata} for a given `Type`.
|
||||
*/
|
||||
resolve(type: Type, throwIfNotFound = true): DirectiveMetadata {
|
||||
resolve(type: Type<any>, throwIfNotFound = true): DirectiveMetadata {
|
||||
var typeMetadata = this._reflector.annotations(resolveForwardRef(type));
|
||||
if (isPresent(typeMetadata)) {
|
||||
var metadata = typeMetadata.find(_isDirectiveMetadata);
|
||||
|
@ -49,7 +48,7 @@ export class DirectiveResolver {
|
|||
|
||||
private _mergeWithPropertyMetadata(
|
||||
dm: DirectiveMetadata, propertyMetadata: {[key: string]: any[]},
|
||||
directiveType: Type): DirectiveMetadata {
|
||||
directiveType: Type<any>): DirectiveMetadata {
|
||||
var inputs: string[] = [];
|
||||
var outputs: string[] = [];
|
||||
var host: {[key: string]: string} = {};
|
||||
|
@ -90,7 +89,7 @@ export class DirectiveResolver {
|
|||
|
||||
private _merge(
|
||||
dm: DirectiveMetadata, inputs: string[], outputs: string[], host: {[key: string]: string},
|
||||
queries: {[key: string]: any}, directiveType: Type): DirectiveMetadata {
|
||||
queries: {[key: string]: any}, directiveType: Type<any>): DirectiveMetadata {
|
||||
let mergedInputs: string[];
|
||||
|
||||
if (isPresent(dm.inputs)) {
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit} from '@angular/core';
|
||||
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, DoCheck, OnChanges, OnDestroy, OnInit, Type} from '@angular/core';
|
||||
|
||||
import {LifecycleHooks, reflector} from '../core_private';
|
||||
|
||||
import {MapWrapper} from './facade/collection';
|
||||
import {Type} from './facade/lang';
|
||||
|
||||
const LIFECYCLE_INTERFACES: Map<any, Type> = MapWrapper.createFromPairs([
|
||||
const LIFECYCLE_INTERFACES: Map<any, Type<any>> = MapWrapper.createFromPairs([
|
||||
[LifecycleHooks.OnInit, OnInit],
|
||||
[LifecycleHooks.OnDestroy, OnDestroy],
|
||||
[LifecycleHooks.DoCheck, DoCheck],
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, AttributeMetadata, BaseException, ChangeDetectionStrategy, ComponentMetadata, HostMetadata, Inject, InjectMetadata, Injectable, ModuleWithProviders, NgModule, NgModuleMetadata, Optional, OptionalMetadata, Provider, QueryMetadata, SchemaMetadata, SelfMetadata, SkipSelfMetadata, ViewMetadata, ViewQueryMetadata, resolveForwardRef} from '@angular/core';
|
||||
import {AnimationAnimateMetadata, AnimationEntryMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadata, AnimationStateDeclarationMetadata, AnimationStateMetadata, AnimationStateTransitionMetadata, AnimationStyleMetadata, AnimationWithStepsMetadata, AttributeMetadata, ChangeDetectionStrategy, ComponentMetadata, HostMetadata, InjectMetadata, Injectable, ModuleWithProviders, OptionalMetadata, Provider, QueryMetadata, SchemaMetadata, SelfMetadata, SkipSelfMetadata, Type, ViewQueryMetadata, resolveForwardRef} from '@angular/core';
|
||||
|
||||
import {Console, LIFECYCLE_HOOKS_VALUES, ReflectorReader, createProvider, isProviderLiteral, reflector} from '../core_private';
|
||||
import {StringMapWrapper} from '../src/facade/collection';
|
||||
|
@ -15,7 +15,8 @@ import {assertArrayOfStrings, assertInterpolationSymbols} from './assertions';
|
|||
import * as cpl from './compile_metadata';
|
||||
import {CompilerConfig} from './config';
|
||||
import {DirectiveResolver} from './directive_resolver';
|
||||
import {Type, isArray, isBlank, isPresent, isString, stringify} from './facade/lang';
|
||||
import {BaseException} from './facade/exceptions';
|
||||
import {isArray, isBlank, isPresent, isString, stringify} from './facade/lang';
|
||||
import {Identifiers, identifierToken} from './identifiers';
|
||||
import {hasLifecycleHook} from './lifecycle_reflector';
|
||||
import {NgModuleResolver} from './ng_module_resolver';
|
||||
|
@ -26,10 +27,10 @@ import {MODULE_SUFFIX, ValueTransformer, sanitizeIdentifier, visitValue} from '.
|
|||
|
||||
@Injectable()
|
||||
export class CompileMetadataResolver {
|
||||
private _directiveCache = new Map<Type, cpl.CompileDirectiveMetadata>();
|
||||
private _pipeCache = new Map<Type, cpl.CompilePipeMetadata>();
|
||||
private _ngModuleCache = new Map<Type, cpl.CompileNgModuleMetadata>();
|
||||
private _ngModuleOfTypes = new Map<Type, Type>();
|
||||
private _directiveCache = new Map<Type<any>, cpl.CompileDirectiveMetadata>();
|
||||
private _pipeCache = new Map<Type<any>, cpl.CompilePipeMetadata>();
|
||||
private _ngModuleCache = new Map<Type<any>, cpl.CompileNgModuleMetadata>();
|
||||
private _ngModuleOfTypes = new Map<Type<any>, Type<any>>();
|
||||
private _anonymousTypes = new Map<Object, number>();
|
||||
private _anonymousTypeIndex = 0;
|
||||
|
||||
|
@ -53,7 +54,7 @@ export class CompileMetadataResolver {
|
|||
return sanitizeIdentifier(identifier);
|
||||
}
|
||||
|
||||
clearCacheFor(type: Type) {
|
||||
clearCacheFor(type: Type<any>) {
|
||||
this._directiveCache.delete(type);
|
||||
this._pipeCache.delete(type);
|
||||
this._ngModuleOfTypes.delete(type);
|
||||
|
@ -110,7 +111,8 @@ export class CompileMetadataResolver {
|
|||
return null;
|
||||
}
|
||||
|
||||
getDirectiveMetadata(directiveType: Type, throwIfNotFound = true): cpl.CompileDirectiveMetadata {
|
||||
getDirectiveMetadata(directiveType: Type<any>, throwIfNotFound = true):
|
||||
cpl.CompileDirectiveMetadata {
|
||||
directiveType = resolveForwardRef(directiveType);
|
||||
var meta = this._directiveCache.get(directiveType);
|
||||
if (isBlank(meta)) {
|
||||
|
@ -241,7 +243,7 @@ export class CompileMetadataResolver {
|
|||
|
||||
if (meta.imports) {
|
||||
flattenArray(meta.imports).forEach((importedType) => {
|
||||
let importedModuleType: Type;
|
||||
let importedModuleType: Type<any>;
|
||||
if (isValidType(importedType)) {
|
||||
importedModuleType = importedType;
|
||||
} else if (importedType && importedType.ngModule) {
|
||||
|
@ -352,7 +354,7 @@ export class CompileMetadataResolver {
|
|||
return compileMeta;
|
||||
}
|
||||
|
||||
addComponentToModule(moduleType: Type, compType: Type) {
|
||||
addComponentToModule(moduleType: Type<any>, compType: Type<any>) {
|
||||
const moduleMeta = this.getNgModuleMetadata(moduleType);
|
||||
// Collect @Component.directives/pipes/entryComponents into our declared directives/pipes.
|
||||
const compMeta = this.getDirectiveMetadata(compType, false);
|
||||
|
@ -395,7 +397,7 @@ export class CompileMetadataResolver {
|
|||
(dirMeta) => { this._getTransitiveViewDirectivesAndPipes(dirMeta, moduleMeta); });
|
||||
}
|
||||
|
||||
private _addTypeToModule(type: Type, moduleType: Type) {
|
||||
private _addTypeToModule(type: Type<any>, moduleType: Type<any>) {
|
||||
const oldModule = this._ngModuleOfTypes.get(type);
|
||||
if (oldModule && oldModule !== moduleType) {
|
||||
throw new BaseException(
|
||||
|
@ -410,13 +412,13 @@ export class CompileMetadataResolver {
|
|||
if (!compMeta.isComponent) {
|
||||
return;
|
||||
}
|
||||
const addPipe = (pipeType: Type) => {
|
||||
const addPipe = (pipeType: Type<any>) => {
|
||||
const pipeMeta = this.getPipeMetadata(pipeType);
|
||||
this._addPipeToModule(
|
||||
pipeMeta, moduleMeta.type.runtime, moduleMeta.transitiveModule, moduleMeta.declaredPipes);
|
||||
};
|
||||
|
||||
const addDirective = (dirType: Type) => {
|
||||
const addDirective = (dirType: Type<any>) => {
|
||||
const dirMeta = this.getDirectiveMetadata(dirType);
|
||||
if (this._addDirectiveToModule(
|
||||
dirMeta, moduleMeta.type.runtime, moduleMeta.transitiveModule,
|
||||
|
@ -484,7 +486,7 @@ export class CompileMetadataResolver {
|
|||
return false;
|
||||
}
|
||||
|
||||
getTypeMetadata(type: Type, moduleUrl: string, dependencies: any[] = null):
|
||||
getTypeMetadata(type: Type<any>, moduleUrl: string, dependencies: any[] = null):
|
||||
cpl.CompileTypeMetadata {
|
||||
type = resolveForwardRef(type);
|
||||
return new cpl.CompileTypeMetadata({
|
||||
|
@ -507,7 +509,7 @@ export class CompileMetadataResolver {
|
|||
});
|
||||
}
|
||||
|
||||
getPipeMetadata(pipeType: Type, throwIfNotFound = true): cpl.CompilePipeMetadata {
|
||||
getPipeMetadata(pipeType: Type<any>, throwIfNotFound = true): cpl.CompilePipeMetadata {
|
||||
pipeType = resolveForwardRef(pipeType);
|
||||
var meta = this._pipeCache.get(pipeType);
|
||||
if (isBlank(meta)) {
|
||||
|
@ -525,7 +527,7 @@ export class CompileMetadataResolver {
|
|||
return meta;
|
||||
}
|
||||
|
||||
getDependenciesMetadata(typeOrFunc: Type|Function, dependencies: any[]):
|
||||
getDependenciesMetadata(typeOrFunc: Type<any>|Function, dependencies: any[]):
|
||||
cpl.CompileDiDependencyMetadata[] {
|
||||
let hasUnknownDeps = false;
|
||||
let params = isPresent(dependencies) ? dependencies : this._reflector.parameters(typeOrFunc);
|
||||
|
@ -694,7 +696,7 @@ export class CompileMetadataResolver {
|
|||
|
||||
getQueriesMetadata(
|
||||
queries: {[key: string]: QueryMetadata}, isViewQuery: boolean,
|
||||
directiveType: Type): cpl.CompileQueryMetadata[] {
|
||||
directiveType: Type<any>): cpl.CompileQueryMetadata[] {
|
||||
var res: cpl.CompileQueryMetadata[] = [];
|
||||
StringMapWrapper.forEach(queries, (query: QueryMetadata, propertyName: string) => {
|
||||
if (query.isViewQuery === isViewQuery) {
|
||||
|
@ -704,7 +706,7 @@ export class CompileMetadataResolver {
|
|||
return res;
|
||||
}
|
||||
|
||||
getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type|Function):
|
||||
getQueryMetadata(q: QueryMetadata, propertyName: string, typeOrFunc: Type<any>|Function):
|
||||
cpl.CompileQueryMetadata {
|
||||
var selectors: cpl.CompileTokenMetadata[];
|
||||
if (q.isVarBindingQuery) {
|
||||
|
@ -729,7 +731,7 @@ export class CompileMetadataResolver {
|
|||
function getTransitiveModules(
|
||||
modules: cpl.CompileNgModuleMetadata[], includeImports: boolean,
|
||||
targetModules: cpl.CompileNgModuleMetadata[] = [],
|
||||
visitedModules = new Set<Type>()): cpl.CompileNgModuleMetadata[] {
|
||||
visitedModules = new Set<Type<any>>()): cpl.CompileNgModuleMetadata[] {
|
||||
modules.forEach((ngModule) => {
|
||||
if (!visitedModules.has(ngModule.type.runtime)) {
|
||||
visitedModules.add(ngModule.type.runtime);
|
||||
|
@ -761,7 +763,7 @@ function flattenArray(tree: any[], out: Array<any> = []): Array<any> {
|
|||
}
|
||||
|
||||
function verifyNonBlankProviders(
|
||||
directiveType: Type, providersTree: any[], providersType: string): any[] {
|
||||
directiveType: Type<any>, providersTree: any[], providersType: string): any[] {
|
||||
var flat: any[] = [];
|
||||
var errMsg: string;
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException, Injectable, NgModuleMetadata} from '@angular/core';
|
||||
import {Injectable, NgModuleMetadata, Type} from '@angular/core';
|
||||
|
||||
import {ReflectorReader, reflector} from '../core_private';
|
||||
|
||||
import {Type, isPresent, stringify} from './facade/lang';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {isPresent, stringify} from './facade/lang';
|
||||
|
||||
function _isNgModuleMetadata(obj: any): obj is NgModuleMetadata {
|
||||
return obj instanceof NgModuleMetadata;
|
||||
|
@ -23,7 +23,7 @@ function _isNgModuleMetadata(obj: any): obj is NgModuleMetadata {
|
|||
export class NgModuleResolver {
|
||||
constructor(private _reflector: ReflectorReader = reflector) {}
|
||||
|
||||
resolve(type: Type, throwIfNotFound = true): NgModuleMetadata {
|
||||
resolve(type: Type<any>, throwIfNotFound = true): NgModuleMetadata {
|
||||
const ngModuleMeta: NgModuleMetadata =
|
||||
this._reflector.annotations(type).find(_isNgModuleMetadata);
|
||||
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException, Injectable, PipeMetadata, resolveForwardRef} from '@angular/core';
|
||||
import {Injectable, PipeMetadata, Type, resolveForwardRef} from '@angular/core';
|
||||
|
||||
import {ReflectorReader, reflector} from '../core_private';
|
||||
|
||||
import {Type, isPresent, stringify} from './facade/lang';
|
||||
import {BaseException} from './facade/exceptions';
|
||||
import {isPresent, stringify} from './facade/lang';
|
||||
|
||||
function _isPipeMetadata(type: any): boolean {
|
||||
return type instanceof PipeMetadata;
|
||||
|
@ -30,7 +31,7 @@ export class PipeResolver {
|
|||
/**
|
||||
* Return {@link PipeMetadata} for a given `Type`.
|
||||
*/
|
||||
resolve(type: Type, throwIfNotFound = true): PipeMetadata {
|
||||
resolve(type: Type<any>, throwIfNotFound = true): PipeMetadata {
|
||||
var metas = this._reflector.annotations(resolveForwardRef(type));
|
||||
if (isPresent(metas)) {
|
||||
var annotation = metas.find(_isPipeMetadata);
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException, Compiler, ComponentFactory, ComponentResolver, ComponentStillLoadingError, Injectable, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadata, OptionalMetadata, Provider, SchemaMetadata, SkipSelfMetadata} from '@angular/core';
|
||||
import {Compiler, ComponentFactory, ComponentResolver, ComponentStillLoadingError, Injectable, Injector, ModuleWithComponentFactories, NgModuleFactory, OptionalMetadata, Provider, SchemaMetadata, SkipSelfMetadata, Type} from '@angular/core';
|
||||
|
||||
import {Console} from '../core_private';
|
||||
|
||||
import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, createHostComponentMeta} from './compile_metadata';
|
||||
import {CompilerConfig} from './config';
|
||||
import {DirectiveNormalizer} from './directive_normalizer';
|
||||
import {ConcreteType, Type, isBlank, isString, stringify} from './facade/lang';
|
||||
import {BaseException} from './facade/exceptions';
|
||||
import {isBlank, isString, stringify} from './facade/lang';
|
||||
import {CompileMetadataResolver} from './metadata_resolver';
|
||||
import {NgModuleCompiler} from './ng_module_compiler';
|
||||
import * as ir from './output/output_ast';
|
||||
|
@ -37,9 +38,9 @@ import {ComponentFactoryDependency, ViewCompiler, ViewFactoryDependency} from '.
|
|||
*/
|
||||
@Injectable()
|
||||
export class RuntimeCompiler implements Compiler {
|
||||
private _compiledTemplateCache = new Map<Type, CompiledTemplate>();
|
||||
private _compiledHostTemplateCache = new Map<Type, CompiledTemplate>();
|
||||
private _compiledNgModuleCache = new Map<Type, NgModuleFactory<any>>();
|
||||
private _compiledTemplateCache = new Map<Type<any>, CompiledTemplate>();
|
||||
private _compiledHostTemplateCache = new Map<Type<any>, CompiledTemplate>();
|
||||
private _compiledNgModuleCache = new Map<Type<any>, NgModuleFactory<any>>();
|
||||
|
||||
constructor(
|
||||
private _injector: Injector, private _metadataResolver: CompileMetadataResolver,
|
||||
|
@ -50,25 +51,24 @@ export class RuntimeCompiler implements Compiler {
|
|||
|
||||
get injector(): Injector { return this._injector; }
|
||||
|
||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
||||
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||
return this._compileModuleAndComponents(moduleType, true).syncResult;
|
||||
}
|
||||
|
||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
||||
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> {
|
||||
return this._compileModuleAndComponents(moduleType, false).asyncResult;
|
||||
}
|
||||
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
||||
ModuleWithComponentFactories<T> {
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||
return this._compileModuleAndAllComponents(moduleType, true).syncResult;
|
||||
}
|
||||
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||
Promise<ModuleWithComponentFactories<T>> {
|
||||
return this._compileModuleAndAllComponents(moduleType, false).asyncResult;
|
||||
}
|
||||
|
||||
compileComponentAsync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
||||
compileComponentAsync<T>(compType: Type<T>, ngModule: Type<any> = null):
|
||||
Promise<ComponentFactory<T>> {
|
||||
if (!ngModule) {
|
||||
throw new BaseException(
|
||||
|
@ -77,8 +77,7 @@ export class RuntimeCompiler implements Compiler {
|
|||
return this._compileComponentInModule(compType, false, ngModule).asyncResult;
|
||||
}
|
||||
|
||||
compileComponentSync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
||||
ComponentFactory<T> {
|
||||
compileComponentSync<T>(compType: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||
if (!ngModule) {
|
||||
throw new BaseException(
|
||||
`Calling compileComponentSync on the root compiler without a module is not allowed! (Compiling component ${stringify(compType)})`);
|
||||
|
@ -86,14 +85,14 @@ export class RuntimeCompiler implements Compiler {
|
|||
return this._compileComponentInModule(compType, true, ngModule).syncResult;
|
||||
}
|
||||
|
||||
private _compileModuleAndComponents<T>(moduleType: ConcreteType<T>, isSync: boolean):
|
||||
private _compileModuleAndComponents<T>(moduleType: Type<T>, isSync: boolean):
|
||||
SyncAsyncResult<NgModuleFactory<T>> {
|
||||
const componentPromise = this._compileComponents(moduleType, isSync);
|
||||
const ngModuleFactory = this._compileModule(moduleType);
|
||||
return new SyncAsyncResult(ngModuleFactory, componentPromise.then(() => ngModuleFactory));
|
||||
}
|
||||
|
||||
private _compileModuleAndAllComponents<T>(moduleType: ConcreteType<T>, isSync: boolean):
|
||||
private _compileModuleAndAllComponents<T>(moduleType: Type<T>, isSync: boolean):
|
||||
SyncAsyncResult<ModuleWithComponentFactories<T>> {
|
||||
const componentPromise = this._compileComponents(moduleType, isSync);
|
||||
const ngModuleFactory = this._compileModule(moduleType);
|
||||
|
@ -121,7 +120,7 @@ export class RuntimeCompiler implements Compiler {
|
|||
return new SyncAsyncResult(syncResult, asyncResult);
|
||||
}
|
||||
|
||||
private _compileModule<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
||||
private _compileModule<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||
let ngModuleFactory = this._compiledNgModuleCache.get(moduleType);
|
||||
if (!ngModuleFactory) {
|
||||
const moduleMeta = this._metadataResolver.getNgModuleMetadata(moduleType);
|
||||
|
@ -156,9 +155,8 @@ export class RuntimeCompiler implements Compiler {
|
|||
return ngModuleFactory;
|
||||
}
|
||||
|
||||
private _compileComponentInModule<T>(
|
||||
compType: ConcreteType<T>, isSync: boolean,
|
||||
moduleType: ConcreteType<any>): SyncAsyncResult<ComponentFactory<T>> {
|
||||
private _compileComponentInModule<T>(compType: Type<T>, isSync: boolean, moduleType: Type<any>):
|
||||
SyncAsyncResult<ComponentFactory<T>> {
|
||||
this._metadataResolver.addComponentToModule(moduleType, compType);
|
||||
|
||||
const componentPromise = this._compileComponents(moduleType, isSync);
|
||||
|
@ -171,7 +169,7 @@ export class RuntimeCompiler implements Compiler {
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
_compileComponents(mainModule: Type, isSync: boolean): Promise<any> {
|
||||
_compileComponents(mainModule: Type<any>, isSync: boolean): Promise<any> {
|
||||
const templates = new Set<CompiledTemplate>();
|
||||
var loadingPromises: Promise<any>[] = [];
|
||||
|
||||
|
@ -208,7 +206,7 @@ export class RuntimeCompiler implements Compiler {
|
|||
}
|
||||
}
|
||||
|
||||
clearCacheFor(type: Type) {
|
||||
clearCacheFor(type: Type<any>) {
|
||||
this._compiledNgModuleCache.delete(type);
|
||||
this._metadataResolver.clearCacheFor(type);
|
||||
this._compiledHostTemplateCache.delete(type);
|
||||
|
@ -227,7 +225,7 @@ export class RuntimeCompiler implements Compiler {
|
|||
this._compiledNgModuleCache.clear();
|
||||
}
|
||||
|
||||
private _createCompiledHostTemplate(compType: Type): CompiledTemplate {
|
||||
private _createCompiledHostTemplate(compType: Type<any>): CompiledTemplate {
|
||||
var compiledTemplate = this._compiledHostTemplateCache.get(compType);
|
||||
if (isBlank(compiledTemplate)) {
|
||||
var compMeta = this._metadataResolver.getDirectiveMetadata(compType);
|
||||
|
@ -350,7 +348,7 @@ class CompiledTemplate {
|
|||
private _normalizedCompMeta: CompileDirectiveMetadata = null;
|
||||
isCompiled = false;
|
||||
isCompiledWithDeps = false;
|
||||
viewComponentTypes: Type[] = [];
|
||||
viewComponentTypes: Type<any>[] = [];
|
||||
viewDirectives: CompileDirectiveMetadata[] = [];
|
||||
|
||||
constructor(
|
||||
|
@ -414,12 +412,12 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver {
|
|||
private _warnOnComponentResolver = true;
|
||||
|
||||
constructor(
|
||||
private _delegate: RuntimeCompiler, private _ngModule: ConcreteType<any>,
|
||||
private _delegate: RuntimeCompiler, private _ngModule: Type<any>,
|
||||
private _parentComponentResolver: ComponentResolver, private _console: Console) {}
|
||||
|
||||
get _injector(): Injector { return this._delegate.injector; }
|
||||
|
||||
resolveComponent(component: Type|string): Promise<ComponentFactory<any>> {
|
||||
resolveComponent(component: Type<any>|string): Promise<ComponentFactory<any>> {
|
||||
if (isString(component)) {
|
||||
if (this._parentComponentResolver) {
|
||||
return this._parentComponentResolver.resolveComponent(component);
|
||||
|
@ -432,32 +430,30 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver {
|
|||
this._console.warn(ComponentResolver.DynamicCompilationDeprecationMsg);
|
||||
this._warnOnComponentResolver = false;
|
||||
}
|
||||
return this.compileComponentAsync(<ConcreteType<any>>component);
|
||||
return this.compileComponentAsync(<Type<any>>component);
|
||||
}
|
||||
|
||||
compileComponentAsync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
||||
compileComponentAsync<T>(compType: Type<T>, ngModule: Type<any> = null):
|
||||
Promise<ComponentFactory<T>> {
|
||||
return this._delegate.compileComponentAsync(compType, ngModule ? ngModule : this._ngModule);
|
||||
}
|
||||
|
||||
compileComponentSync<T>(compType: ConcreteType<T>, ngModule: ConcreteType<any> = null):
|
||||
ComponentFactory<T> {
|
||||
compileComponentSync<T>(compType: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||
return this._delegate.compileComponentSync(compType, ngModule ? ngModule : this._ngModule);
|
||||
}
|
||||
|
||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
||||
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||
return this._delegate.compileModuleSync(moduleType);
|
||||
}
|
||||
|
||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
||||
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> {
|
||||
return this._delegate.compileModuleAsync(moduleType);
|
||||
}
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
||||
ModuleWithComponentFactories<T> {
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||
return this._delegate.compileModuleAndAllComponentsSync(moduleType);
|
||||
}
|
||||
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||
Promise<ModuleWithComponentFactories<T>> {
|
||||
return this._delegate.compileModuleAndAllComponentsAsync(moduleType);
|
||||
}
|
||||
|
@ -475,5 +471,5 @@ class ModuleBoundCompiler implements Compiler, ComponentResolver {
|
|||
/**
|
||||
* Clears the cache for the given component/ngModule.
|
||||
*/
|
||||
clearCacheFor(type: Type) { this._delegate.clearCacheFor(type); }
|
||||
clearCacheFor(type: Type<any>) { this._delegate.clearCacheFor(type); }
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
import {DirectiveResolver, XHR} from '@angular/compiler';
|
||||
import {MockDirectiveResolver} from '@angular/compiler/testing';
|
||||
import {Compiler, Component, ComponentFactory, Injectable, Injector, Input, NgModule, NgModuleFactory, ViewMetadata} from '@angular/core';
|
||||
import {Compiler, Component, ComponentFactory, Injectable, Injector, Input, NgModule, NgModuleFactory, Type, ViewMetadata} from '@angular/core';
|
||||
import {ComponentFixture, TestBed, TestComponentBuilder, fakeAsync, tick} from '@angular/core/testing';
|
||||
import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||
|
||||
import {ConcreteType, stringify} from '../src/facade/lang';
|
||||
import {stringify} from '../src/facade/lang';
|
||||
|
||||
import {SpyXHR} from './spies';
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ export * from './testing/directive_resolver_mock';
|
|||
export * from './testing/ng_module_resolver_mock';
|
||||
export * from './testing/pipe_resolver_mock';
|
||||
|
||||
import {ConcreteType, Type} from './src/facade/lang';
|
||||
import {createPlatformFactory, ModuleWithComponentFactories, Injectable, CompilerOptions, COMPILER_OPTIONS, PlatformRef, CompilerFactory, ComponentFactory, NgModuleFactory, Injector, NgModuleMetadata, NgModuleMetadataType, ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, PipeMetadata, PipeMetadataType} from '@angular/core';
|
||||
import {createPlatformFactory, ModuleWithComponentFactories, Injectable, CompilerOptions, COMPILER_OPTIONS, CompilerFactory, ComponentFactory, NgModuleFactory, Injector, NgModuleMetadata, NgModuleMetadataType, ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, PipeMetadata, PipeMetadataType, Type, PlatformRef} from '@angular/core';
|
||||
import {MetadataOverride} from '@angular/core/testing';
|
||||
import {TestingCompilerFactory, TestingCompiler} from './core_private_testing';
|
||||
import {platformCoreDynamic, RuntimeCompiler, DirectiveResolver, NgModuleResolver, PipeResolver} from './index';
|
||||
|
@ -40,55 +39,51 @@ export class TestingCompilerImpl implements TestingCompiler {
|
|||
private _compiler: RuntimeCompiler, private _directiveResolver: MockDirectiveResolver,
|
||||
private _pipeResolver: MockPipeResolver, private _moduleResolver: MockNgModuleResolver) {}
|
||||
get injector(): Injector { return this._compiler.injector; }
|
||||
compileComponentAsync<T>(component: ConcreteType<T>, ngModule: Type = null):
|
||||
compileComponentAsync<T>(component: Type<T>, ngModule: Type<any> = null):
|
||||
Promise<ComponentFactory<T>> {
|
||||
return this._compiler.compileComponentAsync(component, <any>ngModule);
|
||||
}
|
||||
compileComponentSync<T>(component: ConcreteType<T>, ngModule: Type = null): ComponentFactory<T> {
|
||||
compileComponentSync<T>(component: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||
return this._compiler.compileComponentSync(component, <any>ngModule);
|
||||
}
|
||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> {
|
||||
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||
return this._compiler.compileModuleSync(moduleType);
|
||||
}
|
||||
|
||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
||||
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> {
|
||||
return this._compiler.compileModuleAsync(moduleType);
|
||||
}
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
||||
ModuleWithComponentFactories<T> {
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||
return this._compiler.compileModuleAndAllComponentsSync(moduleType);
|
||||
}
|
||||
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||
Promise<ModuleWithComponentFactories<T>> {
|
||||
return this._compiler.compileModuleAndAllComponentsAsync(moduleType);
|
||||
}
|
||||
|
||||
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>):
|
||||
void {
|
||||
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): void {
|
||||
const oldMetadata = this._moduleResolver.resolve(ngModule, false);
|
||||
this._moduleResolver.setNgModule(
|
||||
ngModule, this._overrider.overrideMetadata(NgModuleMetadata, oldMetadata, override));
|
||||
}
|
||||
overrideDirective(
|
||||
directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
||||
overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
||||
const oldMetadata = this._directiveResolver.resolve(directive, false);
|
||||
this._directiveResolver.setDirective(
|
||||
directive, this._overrider.overrideMetadata(DirectiveMetadata, oldMetadata, override));
|
||||
}
|
||||
overrideComponent(
|
||||
component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
||||
overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
||||
const oldMetadata = this._directiveResolver.resolve(component, false);
|
||||
this._directiveResolver.setDirective(
|
||||
component, this._overrider.overrideMetadata(ComponentMetadata, oldMetadata, override));
|
||||
}
|
||||
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): void {
|
||||
overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): void {
|
||||
const oldMetadata = this._pipeResolver.resolve(pipe, false);
|
||||
this._pipeResolver.setPipe(
|
||||
pipe, this._overrider.overrideMetadata(PipeMetadata, oldMetadata, override));
|
||||
}
|
||||
clearCache(): void { this._compiler.clearCache(); }
|
||||
clearCacheFor(type: Type) { this._compiler.clearCacheFor(type); }
|
||||
clearCacheFor(type: Type<any>) { this._compiler.clearCacheFor(type); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +91,7 @@ export class TestingCompilerImpl implements TestingCompiler {
|
|||
*
|
||||
* @experimental
|
||||
*/
|
||||
export const platformCoreDynamicTesting =
|
||||
export const platformCoreDynamicTesting: (extraProviders?: any[]) => PlatformRef =
|
||||
createPlatformFactory(platformCoreDynamic, 'coreDynamicTesting', [
|
||||
{
|
||||
provide: COMPILER_OPTIONS,
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {AnimationEntryMetadata, BaseException, Compiler, ComponentMetadata, DirectiveMetadata, Injectable, Injector, ViewMetadata, resolveForwardRef} from '@angular/core';
|
||||
import {AnimationEntryMetadata, Compiler, ComponentMetadata, DirectiveMetadata, Injectable, Injector, Type, ViewMetadata, resolveForwardRef} from '@angular/core';
|
||||
|
||||
import {DirectiveResolver} from '../src/directive_resolver';
|
||||
import {Map} from '../src/facade/collection';
|
||||
import {Type, isArray, isPresent, stringify} from '../src/facade/lang';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {isArray, isPresent, stringify} from '../src/facade/lang';
|
||||
|
||||
|
||||
|
||||
|
@ -20,21 +21,21 @@ import {Type, isArray, isPresent, stringify} from '../src/facade/lang';
|
|||
*/
|
||||
@Injectable()
|
||||
export class MockDirectiveResolver extends DirectiveResolver {
|
||||
private _directives = new Map<Type, DirectiveMetadata>();
|
||||
private _providerOverrides = new Map<Type, any[]>();
|
||||
private _viewProviderOverrides = new Map<Type, any[]>();
|
||||
private _views = new Map<Type, ViewMetadata>();
|
||||
private _inlineTemplates = new Map<Type, string>();
|
||||
private _animations = new Map<Type, AnimationEntryMetadata[]>();
|
||||
private _directiveOverrides = new Map<Type, Map<Type, Type>>();
|
||||
private _directives = new Map<Type<any>, DirectiveMetadata>();
|
||||
private _providerOverrides = new Map<Type<any>, any[]>();
|
||||
private _viewProviderOverrides = new Map<Type<any>, any[]>();
|
||||
private _views = new Map<Type<any>, ViewMetadata>();
|
||||
private _inlineTemplates = new Map<Type<any>, string>();
|
||||
private _animations = new Map<Type<any>, AnimationEntryMetadata[]>();
|
||||
private _directiveOverrides = new Map<Type<any>, Map<Type<any>, Type<any>>>();
|
||||
|
||||
constructor(private _injector: Injector) { super(); }
|
||||
|
||||
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
||||
|
||||
private _clearCacheFor(component: Type) { this._compiler.clearCacheFor(component); }
|
||||
private _clearCacheFor(component: Type<any>) { this._compiler.clearCacheFor(component); }
|
||||
|
||||
resolve(type: Type, throwIfNotFound = true): DirectiveMetadata {
|
||||
resolve(type: Type<any>, throwIfNotFound = true): DirectiveMetadata {
|
||||
let metadata = this._directives.get(type);
|
||||
if (!metadata) {
|
||||
metadata = super.resolve(type, throwIfNotFound);
|
||||
|
@ -134,17 +135,17 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
|||
/**
|
||||
* Overrides the {@link DirectiveMetadata} for a directive.
|
||||
*/
|
||||
setDirective(type: Type, metadata: DirectiveMetadata): void {
|
||||
setDirective(type: Type<any>, metadata: DirectiveMetadata): void {
|
||||
this._directives.set(type, metadata);
|
||||
this._clearCacheFor(type);
|
||||
}
|
||||
|
||||
setProvidersOverride(type: Type, providers: any[]): void {
|
||||
setProvidersOverride(type: Type<any>, providers: any[]): void {
|
||||
this._providerOverrides.set(type, providers);
|
||||
this._clearCacheFor(type);
|
||||
}
|
||||
|
||||
setViewProvidersOverride(type: Type, viewProviders: any[]): void {
|
||||
setViewProvidersOverride(type: Type<any>, viewProviders: any[]): void {
|
||||
this._viewProviderOverrides.set(type, viewProviders);
|
||||
this._clearCacheFor(type);
|
||||
}
|
||||
|
@ -152,19 +153,19 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
|||
/**
|
||||
* Overrides the {@link ViewMetadata} for a component.
|
||||
*/
|
||||
setView(component: Type, view: ViewMetadata): void {
|
||||
setView(component: Type<any>, view: ViewMetadata): void {
|
||||
this._views.set(component, view);
|
||||
this._clearCacheFor(component);
|
||||
}
|
||||
/**
|
||||
* Overrides the inline template for a component - other configuration remains unchanged.
|
||||
*/
|
||||
setInlineTemplate(component: Type, template: string): void {
|
||||
setInlineTemplate(component: Type<any>, template: string): void {
|
||||
this._inlineTemplates.set(component, template);
|
||||
this._clearCacheFor(component);
|
||||
}
|
||||
|
||||
setAnimations(component: Type, animations: AnimationEntryMetadata[]): void {
|
||||
setAnimations(component: Type<any>, animations: AnimationEntryMetadata[]): void {
|
||||
this._animations.set(component, animations);
|
||||
this._clearCacheFor(component);
|
||||
}
|
||||
|
@ -172,11 +173,11 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
|||
/**
|
||||
* Overrides a directive from the component {@link ViewMetadata}.
|
||||
*/
|
||||
overrideViewDirective(component: Type, from: Type, to: Type): void {
|
||||
overrideViewDirective(component: Type<any>, from: Type<any>, to: Type<any>): void {
|
||||
var overrides = this._directiveOverrides.get(component);
|
||||
|
||||
if (!overrides) {
|
||||
overrides = new Map<Type, Type>();
|
||||
overrides = new Map<Type<any>, Type<any>>();
|
||||
this._directiveOverrides.set(component, overrides);
|
||||
}
|
||||
|
||||
|
@ -185,7 +186,7 @@ export class MockDirectiveResolver extends DirectiveResolver {
|
|||
}
|
||||
}
|
||||
|
||||
function flattenArray(tree: any[], out: Array<Type|any[]>): void {
|
||||
function flattenArray(tree: any[], out: Array<Type<any>|any[]>): void {
|
||||
if (!isPresent(tree)) return;
|
||||
for (var i = 0; i < tree.length; i++) {
|
||||
var item = resolveForwardRef(tree[i]);
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
import {MetadataOverride} from '@angular/core/testing';
|
||||
|
||||
import {ConcreteType, stringify} from '../src/facade/lang';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {stringify} from '../src/facade/lang';
|
||||
|
||||
type StringMap = {
|
||||
[key: string]: any
|
||||
|
|
|
@ -13,18 +13,18 @@ import {Map} from '../src/facade/collection';
|
|||
|
||||
@Injectable()
|
||||
export class MockNgModuleResolver extends NgModuleResolver {
|
||||
private _ngModules = new Map<Type, NgModuleMetadata>();
|
||||
private _ngModules = new Map<Type<any>, NgModuleMetadata>();
|
||||
|
||||
constructor(private _injector: Injector) { super(); }
|
||||
|
||||
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
||||
|
||||
private _clearCacheFor(component: Type) { this._compiler.clearCacheFor(component); }
|
||||
private _clearCacheFor(component: Type<any>) { this._compiler.clearCacheFor(component); }
|
||||
|
||||
/**
|
||||
* Overrides the {@link NgModuleMetadata} for a module.
|
||||
*/
|
||||
setNgModule(type: Type, metadata: NgModuleMetadata): void {
|
||||
setNgModule(type: Type<any>, metadata: NgModuleMetadata): void {
|
||||
this._ngModules.set(type, metadata);
|
||||
this._clearCacheFor(type);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export class MockNgModuleResolver extends NgModuleResolver {
|
|||
* default
|
||||
* `NgModuleResolver`, see `setNgModule`.
|
||||
*/
|
||||
resolve(type: Type, throwIfNotFound = true): NgModuleMetadata {
|
||||
resolve(type: Type<any>, throwIfNotFound = true): NgModuleMetadata {
|
||||
var metadata = this._ngModules.get(type);
|
||||
if (!metadata) {
|
||||
metadata = super.resolve(type, throwIfNotFound);
|
||||
|
|
|
@ -13,18 +13,18 @@ import {Map} from '../src/facade/collection';
|
|||
|
||||
@Injectable()
|
||||
export class MockPipeResolver extends PipeResolver {
|
||||
private _pipes = new Map<Type, PipeMetadata>();
|
||||
private _pipes = new Map<Type<any>, PipeMetadata>();
|
||||
|
||||
constructor(private _injector: Injector) { super(); }
|
||||
|
||||
private get _compiler(): Compiler { return this._injector.get(Compiler); }
|
||||
|
||||
private _clearCacheFor(pipe: Type) { this._compiler.clearCacheFor(pipe); }
|
||||
private _clearCacheFor(pipe: Type<any>) { this._compiler.clearCacheFor(pipe); }
|
||||
|
||||
/**
|
||||
* Overrides the {@link PipeMetadata} for a pipe.
|
||||
*/
|
||||
setPipe(type: Type, metadata: PipeMetadata): void {
|
||||
setPipe(type: Type<any>, metadata: PipeMetadata): void {
|
||||
this._pipes.set(type, metadata);
|
||||
this._clearCacheFor(type);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export class MockPipeResolver extends PipeResolver {
|
|||
* default
|
||||
* `PipeResolver`, see `setPipe`.
|
||||
*/
|
||||
resolve(type: Type, throwIfNotFound = true): PipeMetadata {
|
||||
resolve(type: Type<any>, throwIfNotFound = true): PipeMetadata {
|
||||
var metadata = this._pipes.get(type);
|
||||
if (!metadata) {
|
||||
metadata = super.resolve(type, throwIfNotFound);
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {AnimationEntryMetadata, Compiler, ComponentFactory, Inject, Injectable, Injector, NgZone, ViewMetadata} from '@angular/core';
|
||||
import {AnimationEntryMetadata, Compiler, ComponentFactory, Inject, Injectable, Injector, NgZone, Type, ViewMetadata} from '@angular/core';
|
||||
import {ComponentFixture, ComponentFixtureNoNgZone, TestBed, TestComponentBuilder} from '@angular/core/testing';
|
||||
|
||||
import {DirectiveResolver} from '../index';
|
||||
import {MapWrapper} from '../src/facade/collection';
|
||||
import {ConcreteType, Type, isPresent} from '../src/facade/lang';
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -23,17 +24,17 @@ import {ConcreteType, Type, isPresent} from '../src/facade/lang';
|
|||
@Injectable()
|
||||
export class OverridingTestComponentBuilder extends TestComponentBuilder {
|
||||
/** @internal */
|
||||
_bindingsOverrides = new Map<Type, any[]>();
|
||||
_bindingsOverrides = new Map<Type<any>, any[]>();
|
||||
/** @internal */
|
||||
_directiveOverrides = new Map<Type, Map<Type, Type>>();
|
||||
_directiveOverrides = new Map<Type<any>, Map<Type<any>, Type<any>>>();
|
||||
/** @internal */
|
||||
_templateOverrides = new Map<Type, string>();
|
||||
_templateOverrides = new Map<Type<any>, string>();
|
||||
/** @internal */
|
||||
_animationOverrides = new Map<Type, AnimationEntryMetadata[]>();
|
||||
_animationOverrides = new Map<Type<any>, AnimationEntryMetadata[]>();
|
||||
/** @internal */
|
||||
_viewBindingsOverrides = new Map<Type, any[]>();
|
||||
_viewBindingsOverrides = new Map<Type<any>, any[]>();
|
||||
/** @internal */
|
||||
_viewOverrides = new Map<Type, ViewMetadata>();
|
||||
_viewOverrides = new Map<Type<any>, ViewMetadata>();
|
||||
|
||||
constructor(@Inject(TestBed) injector: Injector) { super(injector); }
|
||||
|
||||
|
@ -48,54 +49,55 @@ export class OverridingTestComponentBuilder extends TestComponentBuilder {
|
|||
return clone;
|
||||
}
|
||||
|
||||
overrideTemplate(componentType: Type, template: string): OverridingTestComponentBuilder {
|
||||
overrideTemplate(componentType: Type<any>, template: string): OverridingTestComponentBuilder {
|
||||
let clone = this._clone();
|
||||
clone._templateOverrides.set(componentType, template);
|
||||
return clone;
|
||||
}
|
||||
|
||||
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]):
|
||||
overrideAnimations(componentType: Type<any>, animations: AnimationEntryMetadata[]):
|
||||
TestComponentBuilder {
|
||||
var clone = this._clone();
|
||||
clone._animationOverrides.set(componentType, animations);
|
||||
return clone;
|
||||
}
|
||||
|
||||
overrideView(componentType: Type, view: ViewMetadata): OverridingTestComponentBuilder {
|
||||
overrideView(componentType: Type<any>, view: ViewMetadata): OverridingTestComponentBuilder {
|
||||
let clone = this._clone();
|
||||
clone._viewOverrides.set(componentType, view);
|
||||
return clone;
|
||||
}
|
||||
|
||||
overrideDirective(componentType: Type, from: Type, to: Type): OverridingTestComponentBuilder {
|
||||
overrideDirective(componentType: Type<any>, from: Type<any>, to: Type<any>):
|
||||
OverridingTestComponentBuilder {
|
||||
let clone = this._clone();
|
||||
let overridesForComponent = clone._directiveOverrides.get(componentType);
|
||||
if (!isPresent(overridesForComponent)) {
|
||||
clone._directiveOverrides.set(componentType, new Map<Type, Type>());
|
||||
clone._directiveOverrides.set(componentType, new Map<Type<any>, Type<any>>());
|
||||
overridesForComponent = clone._directiveOverrides.get(componentType);
|
||||
}
|
||||
overridesForComponent.set(from, to);
|
||||
return clone;
|
||||
}
|
||||
|
||||
overrideProviders(type: Type, providers: any[]): OverridingTestComponentBuilder {
|
||||
overrideProviders(type: Type<any>, providers: any[]): OverridingTestComponentBuilder {
|
||||
let clone = this._clone();
|
||||
clone._bindingsOverrides.set(type, providers);
|
||||
return clone;
|
||||
}
|
||||
|
||||
overrideViewProviders(type: Type, providers: any[]): OverridingTestComponentBuilder {
|
||||
overrideViewProviders(type: Type<any>, providers: any[]): OverridingTestComponentBuilder {
|
||||
let clone = this._clone();
|
||||
clone._viewBindingsOverrides.set(type, providers);
|
||||
return clone;
|
||||
}
|
||||
|
||||
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>> {
|
||||
createAsync<T>(rootComponentType: Type<T>): Promise<ComponentFixture<T>> {
|
||||
this._applyMetadataOverrides();
|
||||
return super.createAsync(rootComponentType);
|
||||
}
|
||||
|
||||
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T> {
|
||||
createSync<T>(rootComponentType: Type<T>): ComponentFixture<T> {
|
||||
this._applyMetadataOverrides();
|
||||
return super.createSync(rootComponentType);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ export * from './src/platform_core_providers';
|
|||
export {APPLICATION_COMMON_PROVIDERS, ApplicationModule} from './src/application_module';
|
||||
export {wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, WtfScopeFn} from './src/profile/profile';
|
||||
|
||||
export {Type} from './src/facade/lang';
|
||||
export {Type} from './src/type';
|
||||
export {EventEmitter} from './src/facade/async';
|
||||
export {ExceptionHandler, WrappedException, BaseException} from './src/facade/exceptions';
|
||||
export * from './private_export';
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../src/facade/lang';
|
||||
|
||||
import {ApplicationInitStatus} from './application_init';
|
||||
import {ApplicationRef, ApplicationRef_, isDevMode} from './application_ref';
|
||||
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
||||
|
@ -18,6 +16,7 @@ import {ComponentResolver} from './linker/component_resolver';
|
|||
import {DynamicComponentLoader, DynamicComponentLoader_} from './linker/dynamic_component_loader';
|
||||
import {ViewUtils} from './linker/view_utils';
|
||||
import {NgModule} from './metadata';
|
||||
import {Type} from './type';
|
||||
|
||||
export function _iterableDiffersFactory() {
|
||||
return defaultIterableDiffers;
|
||||
|
@ -33,7 +32,7 @@ export function _keyValueDiffersFactory() {
|
|||
*
|
||||
* @deprecated Include `ApplicationModule` instead.
|
||||
*/
|
||||
export const APPLICATION_COMMON_PROVIDERS: Array<Type|{[k: string]: any}|any[]> = [];
|
||||
export const APPLICATION_COMMON_PROVIDERS: Array<Type<any>|{[k: string]: any}|any[]> = [];
|
||||
|
||||
/**
|
||||
* This module includes the providers of @angular/core that are needed
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {BaseException, ExceptionHandler, unimplemented} from '../src/facade/exceptions';
|
||||
import {ConcreteType, Type, isBlank, isPresent, isPromise, stringify} from '../src/facade/lang';
|
||||
import {isBlank, isPresent, isPromise, stringify} from '../src/facade/lang';
|
||||
|
||||
import {ApplicationInitStatus} from './application_init';
|
||||
import {APP_BOOTSTRAP_LISTENER, PLATFORM_INITIALIZER} from './application_tokens';
|
||||
|
@ -22,6 +22,7 @@ import {ComponentResolver} from './linker/component_resolver';
|
|||
import {NgModuleFactory, NgModuleInjector, NgModuleRef} from './linker/ng_module_factory';
|
||||
import {WtfScopeFn, wtfCreateScope, wtfLeave} from './profile/profile';
|
||||
import {Testability, TestabilityRegistry} from './testability/testability';
|
||||
import {Type} from './type';
|
||||
import {NgZone, NgZoneError} from './zone/ng_zone';
|
||||
|
||||
var _devMode: boolean = true;
|
||||
|
@ -182,7 +183,7 @@ export function coreBootstrap<C>(
|
|||
* @deprecated Use {@link bootstrapModule} instead.
|
||||
*/
|
||||
export function coreLoadAndBootstrap(
|
||||
componentType: Type, injector: Injector): Promise<ComponentRef<any>> {
|
||||
componentType: Type<any>, injector: Injector): Promise<ComponentRef<any>> {
|
||||
throw new BaseException('coreLoadAndBootstrap is deprecated. Use bootstrapModule instead.');
|
||||
}
|
||||
|
||||
|
@ -239,9 +240,8 @@ export abstract class PlatformRef {
|
|||
* ```
|
||||
* @stable
|
||||
*/
|
||||
bootstrapModule<M>(
|
||||
moduleType: ConcreteType<M>,
|
||||
compilerOptions: CompilerOptions|CompilerOptions[] = []): Promise<NgModuleRef<M>> {
|
||||
bootstrapModule<M>(moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = []):
|
||||
Promise<NgModuleRef<M>> {
|
||||
throw unimplemented();
|
||||
}
|
||||
|
||||
|
@ -373,14 +373,13 @@ export class PlatformRef_ extends PlatformRef {
|
|||
});
|
||||
}
|
||||
|
||||
bootstrapModule<M>(
|
||||
moduleType: ConcreteType<M>,
|
||||
compilerOptions: CompilerOptions|CompilerOptions[] = []): Promise<NgModuleRef<M>> {
|
||||
bootstrapModule<M>(moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = []):
|
||||
Promise<NgModuleRef<M>> {
|
||||
return this._bootstrapModuleWithZone(moduleType, compilerOptions, null);
|
||||
}
|
||||
|
||||
private _bootstrapModuleWithZone<M>(
|
||||
moduleType: ConcreteType<M>, compilerOptions: CompilerOptions|CompilerOptions[] = [],
|
||||
moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = [],
|
||||
ngZone: NgZone): Promise<NgModuleRef<M>> {
|
||||
const compilerFactory: CompilerFactory = this.injector.get(CompilerFactory);
|
||||
const compiler = compilerFactory.createCompiler(
|
||||
|
@ -455,7 +454,7 @@ export abstract class ApplicationRef {
|
|||
* ### Example
|
||||
* {@example core/ts/platform/platform.ts region='longform'}
|
||||
*/
|
||||
abstract bootstrap<C>(componentFactory: ComponentFactory<C>|ConcreteType<C>): ComponentRef<C>;
|
||||
abstract bootstrap<C>(componentFactory: ComponentFactory<C>|Type<C>): ComponentRef<C>;
|
||||
|
||||
/**
|
||||
* Retrieve the application {@link Injector}.
|
||||
|
@ -496,7 +495,7 @@ export abstract class ApplicationRef {
|
|||
* Get a list of component types registered to this application.
|
||||
* This list is populated even before the component is created.
|
||||
*/
|
||||
get componentTypes(): Type[] { return <Type[]>unimplemented(); };
|
||||
get componentTypes(): Type<any>[] { return <Type<any>[]>unimplemented(); };
|
||||
|
||||
/**
|
||||
* Get a list of components registered to this application.
|
||||
|
@ -515,7 +514,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
*/
|
||||
private _disposeListeners: Function[] = [];
|
||||
private _rootComponents: ComponentRef<any>[] = [];
|
||||
private _rootComponentTypes: Type[] = [];
|
||||
private _rootComponentTypes: Type<any>[] = [];
|
||||
private _changeDetectorRefs: ChangeDetectorRef[] = [];
|
||||
private _runningTick: boolean = false;
|
||||
private _enforceNoNewChanges: boolean = false;
|
||||
|
@ -567,7 +566,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
() => _callAndReportToExceptionHandler(this._exceptionHandler, <any>callback));
|
||||
}
|
||||
|
||||
bootstrap<C>(componentOrFactory: ComponentFactory<C>|ConcreteType<C>): ComponentRef<C> {
|
||||
bootstrap<C>(componentOrFactory: ComponentFactory<C>|Type<C>): ComponentRef<C> {
|
||||
if (!this._initStatus.done) {
|
||||
throw new BaseException(
|
||||
'Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
||||
|
@ -655,7 +654,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
|||
*/
|
||||
dispose(): void { this.ngOnDestroy(); }
|
||||
|
||||
get componentTypes(): Type[] { return this._rootComponentTypes; }
|
||||
get componentTypes(): Type<any>[] { return this._rootComponentTypes; }
|
||||
|
||||
get components(): ComponentRef<any>[] { return this._rootComponents; }
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type, isFunction, stringify} from '../facade/lang';
|
||||
import {isFunction, stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -31,10 +32,10 @@ export interface ForwardRefFn { (): any; }
|
|||
* {@example core/di/ts/forward_ref/forward_ref.ts region='forward_ref'}
|
||||
* @experimental
|
||||
*/
|
||||
export function forwardRef(forwardRefFn: ForwardRefFn): Type {
|
||||
export function forwardRef(forwardRefFn: ForwardRefFn): Type<any> {
|
||||
(<any>forwardRefFn).__forward_ref__ = forwardRef;
|
||||
(<any>forwardRefFn).toString = function() { return stringify(this()); };
|
||||
return (<Type><any>forwardRefFn);
|
||||
return (<Type<any>><any>forwardRefFn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
*/
|
||||
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {Type, isBlank, isFunction, isType, normalizeBool, stringify} from '../facade/lang';
|
||||
import {isBlank, isFunction, isType, normalizeBool, stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -61,7 +62,7 @@ export class Provider {
|
|||
* expect(injectorAlias.get(Vehicle) instanceof Car).toBe(true);
|
||||
* ```
|
||||
*/
|
||||
useClass: Type;
|
||||
useClass: Type<any>;
|
||||
|
||||
/**
|
||||
* Binds a DI token to a value.
|
||||
|
@ -157,7 +158,7 @@ export class Provider {
|
|||
_multi: boolean;
|
||||
|
||||
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useClass?: Type<any>,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
|
@ -213,7 +214,7 @@ export class Provider {
|
|||
*/
|
||||
export class Binding extends Provider {
|
||||
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||
toClass?: Type,
|
||||
toClass?: Type<any>,
|
||||
toValue?: any,
|
||||
toAlias?: any,
|
||||
toFactory: Function, deps?: Object[], multi?: boolean
|
||||
|
@ -301,7 +302,7 @@ export class ProviderBuilder {
|
|||
* expect(injectorAlias.get(Vehicle) instanceof Car).toBe(true);
|
||||
* ```
|
||||
*/
|
||||
toClass(type: Type): Provider {
|
||||
toClass(type: Type<any>): Provider {
|
||||
if (!isType(type)) {
|
||||
throw new BaseException(
|
||||
`Trying to create a class provider but "${stringify(type)}" is not a class!`);
|
||||
|
@ -396,7 +397,7 @@ export class ProviderBuilder {
|
|||
* @deprecated
|
||||
*/
|
||||
export function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useClass?: Type<any>,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {BaseException, WrappedException} from '../facade/exceptions';
|
||||
import {Type, isBlank, stringify} from '../facade/lang';
|
||||
import {isBlank, stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {Provider} from './provider';
|
||||
import {ReflectiveInjector} from './reflective_injector';
|
||||
|
@ -225,11 +226,11 @@ export class InvalidProviderError extends BaseException {
|
|||
* @stable
|
||||
*/
|
||||
export class NoAnnotationError extends BaseException {
|
||||
constructor(typeOrFunc: Type|Function, params: any[][]) {
|
||||
constructor(typeOrFunc: Type<any>|Function, params: any[][]) {
|
||||
super(NoAnnotationError._genMessage(typeOrFunc, params));
|
||||
}
|
||||
|
||||
private static _genMessage(typeOrFunc: Type|Function, params: any[][]) {
|
||||
private static _genMessage(typeOrFunc: Type<any>|Function, params: any[][]) {
|
||||
var signature: string[] = [];
|
||||
for (var i = 0, ii = params.length; i < ii; i++) {
|
||||
var parameter = params[i];
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
||||
import {Type} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {Injector, THROW_IF_NOT_FOUND} from './injector';
|
||||
import {SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||
|
@ -17,7 +17,7 @@ import {AbstractProviderError, CyclicDependencyError, InstantiationError, NoProv
|
|||
import {ReflectiveKey} from './reflective_key';
|
||||
import {ReflectiveDependency, ResolvedReflectiveFactory, ResolvedReflectiveProvider, resolveReflectiveProviders} from './reflective_provider';
|
||||
|
||||
var __unused: Type; // avoid unused import when Type union types are erased
|
||||
var __unused: Type<any>; // avoid unused import when Type union types are erased
|
||||
|
||||
// Threshold for the dynamic version
|
||||
const _MAX_CONSTRUCTION_COUNTER = 10;
|
||||
|
@ -392,7 +392,7 @@ export abstract class ReflectiveInjector implements Injector {
|
|||
*
|
||||
* See {@link ReflectiveInjector#fromResolvedProviders} for more info.
|
||||
*/
|
||||
static resolve(providers: Array<Type|Provider|{[k: string]: any}|any[]>):
|
||||
static resolve(providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>):
|
||||
ResolvedReflectiveProvider[] {
|
||||
return resolveReflectiveProviders(providers);
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ export abstract class ReflectiveInjector implements Injector {
|
|||
* See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}.
|
||||
*/
|
||||
static resolveAndCreate(
|
||||
providers: Array<Type|Provider|{[k: string]: any}|any[]>,
|
||||
providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>,
|
||||
parent: Injector = null): ReflectiveInjector {
|
||||
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
||||
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
||||
|
@ -516,7 +516,7 @@ export abstract class ReflectiveInjector implements Injector {
|
|||
* because it needs to resolve the passed-in providers first.
|
||||
* See {@link Injector#resolve} and {@link Injector#createChildFromResolved}.
|
||||
*/
|
||||
resolveAndCreateChild(providers: Array<Type|Provider|{[k: string]: any}|any[]>):
|
||||
resolveAndCreateChild(providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>):
|
||||
ReflectiveInjector {
|
||||
return unimplemented();
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ export abstract class ReflectiveInjector implements Injector {
|
|||
* expect(car).not.toBe(injector.resolveAndInstantiate(Car));
|
||||
* ```
|
||||
*/
|
||||
resolveAndInstantiate(provider: Type|Provider): any { return unimplemented(); }
|
||||
resolveAndInstantiate(provider: Type<any>|Provider): any { return unimplemented(); }
|
||||
|
||||
/**
|
||||
* Instantiates an object using a resolved provider in the context of the injector.
|
||||
|
@ -644,7 +644,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
|||
*/
|
||||
get internalStrategy(): any { return this._strategy; }
|
||||
|
||||
resolveAndCreateChild(providers: Array<Type|Provider|any[]>): ReflectiveInjector {
|
||||
resolveAndCreateChild(providers: Array<Type<any>|Provider|any[]>): ReflectiveInjector {
|
||||
var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
||||
return this.createChildFromResolved(ResolvedReflectiveProviders);
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
|||
return inj;
|
||||
}
|
||||
|
||||
resolveAndInstantiate(provider: Type|Provider): any {
|
||||
resolveAndInstantiate(provider: Type<any>|Provider): any {
|
||||
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
*/
|
||||
|
||||
import {ListWrapper, MapWrapper} from '../facade/collection';
|
||||
import {Type, isArray, isBlank, isPresent} from '../facade/lang';
|
||||
import {isArray, isBlank, isPresent} from '../facade/lang';
|
||||
import {reflector} from '../reflection/reflection';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
import {DependencyMetadata, HostMetadata, InjectMetadata, OptionalMetadata, SelfMetadata, SkipSelfMetadata} from './metadata';
|
||||
|
@ -18,6 +19,7 @@ import {InvalidProviderError, MixingMultiProvidersWithRegularProvidersError, NoA
|
|||
import {ReflectiveKey} from './reflective_key';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* `Dependency` is used by the framework to extend DI.
|
||||
* This is internal to Angular and should not be used directly.
|
||||
|
@ -54,7 +56,7 @@ const _EMPTY_LIST: any[] = [];
|
|||
*/
|
||||
export interface ResolvedReflectiveProvider {
|
||||
/**
|
||||
* A key, usually a `Type`.
|
||||
* A key, usually a `Type<any>`.
|
||||
*/
|
||||
key: ReflectiveKey;
|
||||
|
||||
|
@ -140,7 +142,7 @@ export function resolveReflectiveProvider(provider: Provider): ResolvedReflectiv
|
|||
* Resolve a list of Providers.
|
||||
*/
|
||||
export function resolveReflectiveProviders(
|
||||
providers: Array<Type|Provider|{[k: string]: any}|any[]>): ResolvedReflectiveProvider[] {
|
||||
providers: Array<Type<any>|Provider|{[k: string]: any}|any[]>): ResolvedReflectiveProvider[] {
|
||||
var normalized = _normalizeProviders(providers, []);
|
||||
var resolved = normalized.map(resolveReflectiveProvider);
|
||||
return MapWrapper.values(
|
||||
|
@ -185,7 +187,7 @@ export function mergeResolvedReflectiveProviders(
|
|||
}
|
||||
|
||||
function _normalizeProviders(
|
||||
providers: Array<Type|Provider|{[k: string]: any}|ProviderBuilder|any[]>,
|
||||
providers: Array<Type<any>|Provider|{[k: string]: any}|ProviderBuilder|any[]>,
|
||||
res: Provider[]): Provider[] {
|
||||
providers.forEach(b => {
|
||||
if (b instanceof Type) {
|
||||
|
|
|
@ -6,23 +6,24 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injector, OpaqueToken} from '../di';
|
||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
||||
import {ConcreteType, Type, stringify} from '../facade/lang';
|
||||
import {NgModuleMetadata, ViewEncapsulation} from '../metadata';
|
||||
import {OpaqueToken} from '../di';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {stringify} from '../facade/lang';
|
||||
import {ViewEncapsulation} from '../metadata';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
import {NgModuleFactory} from './ng_module_factory';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Indicates that a component is still being loaded in a synchronous compile.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export class ComponentStillLoadingError extends BaseException {
|
||||
constructor(public compType: Type) {
|
||||
constructor(public compType: Type<any>) {
|
||||
super(`Can't compile synchronously as ${stringify(compType)} is still being loaded!`);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +58,7 @@ export class Compiler {
|
|||
/**
|
||||
* Loads the template and styles of a component and returns the associated `ComponentFactory`.
|
||||
*/
|
||||
compileComponentAsync<T>(component: ConcreteType<T>, ngModule: Type = null):
|
||||
compileComponentAsync<T>(component: Type<T>, ngModule: Type<any> = null):
|
||||
Promise<ComponentFactory<T>> {
|
||||
throw _throwError();
|
||||
}
|
||||
|
@ -65,7 +66,7 @@ export class Compiler {
|
|||
* Compiles the given component. All templates have to be either inline or compiled via
|
||||
* `compileComponentAsync` before. Otherwise throws a {@link ComponentStillLoadingError}.
|
||||
*/
|
||||
compileComponentSync<T>(component: ConcreteType<T>, ngModule: Type = null): ComponentFactory<T> {
|
||||
compileComponentSync<T>(component: Type<T>, ngModule: Type<any> = null): ComponentFactory<T> {
|
||||
throw _throwError();
|
||||
}
|
||||
/**
|
||||
|
@ -73,27 +74,24 @@ export class Compiler {
|
|||
* in `entryComponents`
|
||||
* have to be inlined. Otherwise throws a {@link ComponentStillLoadingError}.
|
||||
*/
|
||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T> { throw _throwError(); }
|
||||
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> { throw _throwError(); }
|
||||
|
||||
/**
|
||||
* Compiles the given NgModule and all of its components
|
||||
*/
|
||||
compileModuleAsync<T>(moduleType: ConcreteType<T>): Promise<NgModuleFactory<T>> {
|
||||
throw _throwError();
|
||||
}
|
||||
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> { throw _throwError(); }
|
||||
|
||||
/**
|
||||
* Same as {@link compileModuleSync} put also creates ComponentFactories for all components.
|
||||
*/
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: ConcreteType<T>):
|
||||
ModuleWithComponentFactories<T> {
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> {
|
||||
throw _throwError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as {@link compileModuleAsync} put also creates ComponentFactories for all components.
|
||||
*/
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: ConcreteType<T>):
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>):
|
||||
Promise<ModuleWithComponentFactories<T>> {
|
||||
throw _throwError();
|
||||
}
|
||||
|
@ -106,7 +104,7 @@ export class Compiler {
|
|||
/**
|
||||
* Clears the cache for the given component/ngModule.
|
||||
*/
|
||||
clearCacheFor(type: Type) {}
|
||||
clearCacheFor(type: Type<any>) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
||||
import {Injector} from '../di/injector';
|
||||
import {unimplemented} from '../facade/exceptions';
|
||||
import {Type, isBlank} from '../facade/lang';
|
||||
import {isBlank} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {AppElement} from './element';
|
||||
import {ElementRef} from './element_ref';
|
||||
import {ViewRef} from './view_ref';
|
||||
|
@ -53,7 +54,7 @@ export abstract class ComponentRef<C> {
|
|||
/**
|
||||
* The component type.
|
||||
*/
|
||||
get componentType(): Type { return unimplemented(); }
|
||||
get componentType(): Type<any> { return unimplemented(); }
|
||||
|
||||
/**
|
||||
* Destroys the component instance and all of the data structures associated with it.
|
||||
|
@ -67,13 +68,13 @@ export abstract class ComponentRef<C> {
|
|||
}
|
||||
|
||||
export class ComponentRef_<C> extends ComponentRef<C> {
|
||||
constructor(private _hostElement: AppElement, private _componentType: Type) { super(); }
|
||||
constructor(private _hostElement: AppElement, private _componentType: Type<any>) { super(); }
|
||||
get location(): ElementRef { return this._hostElement.elementRef; }
|
||||
get injector(): Injector { return this._hostElement.injector; }
|
||||
get instance(): C { return this._hostElement.component; };
|
||||
get hostView(): ViewRef { return this._hostElement.parentView.ref; };
|
||||
get changeDetectorRef(): ChangeDetectorRef { return this._hostElement.parentView.ref; };
|
||||
get componentType(): Type { return this._componentType; }
|
||||
get componentType(): Type<any> { return this._componentType; }
|
||||
|
||||
destroy(): void { this._hostElement.parentView.destroy(); }
|
||||
onDestroy(callback: Function): void { this.hostView.onDestroy(callback); }
|
||||
|
@ -89,9 +90,9 @@ const EMPTY_CONTEXT = new Object();
|
|||
*/
|
||||
export class ComponentFactory<C> {
|
||||
constructor(
|
||||
public selector: string, private _viewFactory: Function, private _componentType: Type) {}
|
||||
public selector: string, private _viewFactory: Function, private _componentType: Type<any>) {}
|
||||
|
||||
get componentType(): Type { return this._componentType; }
|
||||
get componentType(): Type<any> { return this._componentType; }
|
||||
|
||||
/**
|
||||
* Creates a new component.
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
*/
|
||||
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {ConcreteType, stringify} from '../facade/lang';
|
||||
import {stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
|
||||
|
||||
/**
|
||||
* @stable
|
||||
*/
|
||||
|
@ -30,7 +33,7 @@ class _NullComponentFactoryResolver implements ComponentFactoryResolver {
|
|||
*/
|
||||
export abstract class ComponentFactoryResolver {
|
||||
static NULL: ComponentFactoryResolver = new _NullComponentFactoryResolver();
|
||||
abstract resolveComponentFactory<T>(component: ConcreteType<T>): ComponentFactory<T>;
|
||||
abstract resolveComponentFactory<T>(component: Type<T>): ComponentFactory<T>;
|
||||
}
|
||||
|
||||
export class CodegenComponentFactoryResolver implements ComponentFactoryResolver {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {ComponentFactory} from './component_factory';
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,6 @@ export abstract class ComponentResolver {
|
|||
'ComponentResolver is deprecated for lazy loading. Use NgModuleFactoryLoader instead.';
|
||||
|
||||
|
||||
abstract resolveComponent(component: Type|string): Promise<ComponentFactory<any>>;
|
||||
abstract resolveComponent(component: Type<any>|string): Promise<ComponentFactory<any>>;
|
||||
abstract clearCache(): void;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
*/
|
||||
|
||||
import {Injectable, Injector, ReflectiveInjector, ResolvedReflectiveProvider} from '../di';
|
||||
import {Type, isPresent} from '../facade/lang';
|
||||
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {Compiler} from './compiler';
|
||||
import {ComponentRef} from './component_factory';
|
||||
import {ViewContainerRef} from './view_container_ref';
|
||||
|
@ -70,8 +70,8 @@ export abstract class DynamicComponentLoader {
|
|||
* ```
|
||||
*/
|
||||
abstract loadAsRoot(
|
||||
type: Type, overrideSelectorOrNode: string|any, injector: Injector, onDispose?: () => void,
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
type: Type<any>, overrideSelectorOrNode: string|any, injector: Injector,
|
||||
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -115,7 +115,7 @@ export abstract class DynamicComponentLoader {
|
|||
* ```
|
||||
*/
|
||||
abstract loadNextToLocation(
|
||||
type: Type, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[],
|
||||
type: Type<any>, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[],
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,8 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
|||
constructor(private _compiler: Compiler) { super(); }
|
||||
|
||||
loadAsRoot(
|
||||
type: Type, overrideSelectorOrNode: string|any, injector: Injector, onDispose?: () => void,
|
||||
projectableNodes?: any[][]): Promise<ComponentRef<any>> {
|
||||
type: Type<any>, overrideSelectorOrNode: string|any, injector: Injector,
|
||||
onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>> {
|
||||
return this._compiler.compileComponentAsync(<any>type).then(componentFactory => {
|
||||
var componentRef = componentFactory.create(
|
||||
injector, projectableNodes,
|
||||
|
@ -138,7 +138,7 @@ export class DynamicComponentLoader_ extends DynamicComponentLoader {
|
|||
}
|
||||
|
||||
loadNextToLocation(
|
||||
type: Type, location: ViewContainerRef, providers: ResolvedReflectiveProvider[] = null,
|
||||
type: Type<any>, location: ViewContainerRef, providers: ResolvedReflectiveProvider[] = null,
|
||||
projectableNodes: any[][] = null): Promise<ComponentRef<any>> {
|
||||
return this._compiler.compileComponentAsync(<any>type).then(componentFactory => {
|
||||
var contextInjector = location.parentInjector;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
|
||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
||||
import {ConcreteType, stringify} from '../facade/lang';
|
||||
|
||||
import {stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {CodegenComponentFactoryResolver, ComponentFactoryResolver} from './component_factory_resolver';
|
||||
|
||||
|
@ -57,9 +57,9 @@ export abstract class NgModuleRef<T> {
|
|||
export class NgModuleFactory<T> {
|
||||
constructor(
|
||||
private _injectorClass: {new (parentInjector: Injector): NgModuleInjector<T>},
|
||||
private _moduleype: ConcreteType<T>) {}
|
||||
private _moduleype: Type<T>) {}
|
||||
|
||||
get moduleType(): ConcreteType<T> { return this._moduleype; }
|
||||
get moduleType(): Type<T> { return this._moduleype; }
|
||||
|
||||
create(parentInjector: Injector): NgModuleRef<T> {
|
||||
if (!parentInjector) {
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
import {Console} from '../console';
|
||||
import {Injectable} from '../di';
|
||||
import {Type, global, isString} from '../facade/lang';
|
||||
|
||||
import {global, isString} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {ComponentFactory} from './component_factory';
|
||||
import {ComponentResolver} from './component_resolver';
|
||||
|
||||
|
@ -26,7 +26,7 @@ const _SEPARATOR = '#';
|
|||
export class SystemJsComponentResolver implements ComponentResolver {
|
||||
constructor(private _resolver: ComponentResolver, private _console: Console) {}
|
||||
|
||||
resolveComponent(componentType: string|Type): Promise<ComponentFactory<any>> {
|
||||
resolveComponent(componentType: string|Type<any>): Promise<ComponentFactory<any>> {
|
||||
if (isString(componentType)) {
|
||||
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
||||
let [module, component] = componentType.split(_SEPARATOR);
|
||||
|
@ -60,7 +60,7 @@ const FACTORY_CLASS_SUFFIX = 'NgFactory';
|
|||
@Injectable()
|
||||
export class SystemJsCmpFactoryResolver implements ComponentResolver {
|
||||
constructor(private _console: Console) {}
|
||||
resolveComponent(componentType: string|Type): Promise<ComponentFactory<any>> {
|
||||
resolveComponent(componentType: string|Type<any>): Promise<ComponentFactory<any>> {
|
||||
if (isString(componentType)) {
|
||||
this._console.warn(ComponentResolver.LazyLoadingDeprecationMsg);
|
||||
let [module, factory] = componentType.split(_SEPARATOR);
|
||||
|
|
|
@ -11,14 +11,11 @@
|
|||
* to be used by the decorator versions of these annotations.
|
||||
*/
|
||||
|
||||
import {ChangeDetectionStrategy} from '../src/change_detection/change_detection';
|
||||
import {Type} from '../src/facade/lang';
|
||||
|
||||
import {AnimationEntryMetadata} from './animation/metadata';
|
||||
import {AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
||||
import {ComponentMetadata, ComponentMetadataType, DirectiveMetadata, DirectiveMetadataType, HostBindingMetadata, HostListenerMetadata, InputMetadata, OutputMetadata, PipeMetadata, PipeMetadataType} from './metadata/directives';
|
||||
import {ModuleWithProviders, NgModuleMetadata, NgModuleMetadataType, SchemaMetadata} from './metadata/ng_module';
|
||||
import {ViewEncapsulation} from './metadata/view';
|
||||
import {Type} from './type';
|
||||
import {TypeDecorator, makeDecorator, makeParamDecorator, makePropDecorator} from './util/decorators';
|
||||
|
||||
export {ANALYZE_FOR_ENTRY_COMPONENTS, AttributeMetadata, ContentChildMetadata, ContentChildrenMetadata, QueryMetadata, ViewChildMetadata, ViewChildrenMetadata, ViewQueryMetadata} from './metadata/di';
|
||||
|
@ -28,6 +25,7 @@ export {CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NgModuleMetadata, NgModuleM
|
|||
export {ViewEncapsulation, ViewMetadata} from './metadata/view';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Interface for the {@link DirectiveMetadata} decorator function.
|
||||
*
|
||||
|
@ -218,10 +216,11 @@ export interface AttributeMetadataFactory {
|
|||
* @deprecated
|
||||
*/
|
||||
export interface QueryMetadataFactory {
|
||||
(selector: Type|string,
|
||||
(selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): ParameterDecorator;
|
||||
new (selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}):
|
||||
QueryMetadata;
|
||||
new (
|
||||
selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): QueryMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -229,9 +228,11 @@ export interface QueryMetadataFactory {
|
|||
* @stable
|
||||
*/
|
||||
export interface ContentChildrenMetadataFactory {
|
||||
(selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}): any;
|
||||
new (selector: Type|string, {descendants, read}?: {descendants?: boolean, read?: any}):
|
||||
ContentChildrenMetadata;
|
||||
(selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): any;
|
||||
new (
|
||||
selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): ContentChildrenMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,8 +240,8 @@ export interface ContentChildrenMetadataFactory {
|
|||
* @stable
|
||||
*/
|
||||
export interface ContentChildMetadataFactory {
|
||||
(selector: Type|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type|string, {read}?: {read?: any}): ContentChildMetadataFactory;
|
||||
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ContentChildMetadataFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -248,8 +249,8 @@ export interface ContentChildMetadataFactory {
|
|||
* @stable
|
||||
*/
|
||||
export interface ViewChildrenMetadataFactory {
|
||||
(selector: Type|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type|string, {read}?: {read?: any}): ViewChildrenMetadata;
|
||||
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChildrenMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,8 +258,8 @@ export interface ViewChildrenMetadataFactory {
|
|||
* @stable
|
||||
*/
|
||||
export interface ViewChildMetadataFactory {
|
||||
(selector: Type|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type|string, {read}?: {read?: any}): ViewChildMetadataFactory;
|
||||
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChildMetadataFactory;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
import {resolveForwardRef} from '../di/forward_ref';
|
||||
import {DependencyMetadata} from '../di/metadata';
|
||||
import {OpaqueToken} from '../di/opaque_token';
|
||||
import {StringWrapper, Type, isString, stringify} from '../facade/lang';
|
||||
import {StringWrapper, isString, stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
/**
|
||||
* This token can be used to create a virtual provider that will populate the
|
||||
|
@ -199,11 +200,10 @@ export class QueryMetadata extends DependencyMetadata {
|
|||
*/
|
||||
read: any;
|
||||
|
||||
constructor(private _selector: Type|string, {descendants = false, first = false, read = null}: {
|
||||
descendants?: boolean,
|
||||
first?: boolean,
|
||||
read?: any
|
||||
} = {}) {
|
||||
constructor(
|
||||
private _selector: Type<any>|string,
|
||||
{descendants = false, first = false,
|
||||
read = null}: {descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||
super();
|
||||
this.descendants = descendants;
|
||||
this.first = first;
|
||||
|
@ -258,7 +258,7 @@ export class QueryMetadata extends DependencyMetadata {
|
|||
*/
|
||||
export class ContentChildrenMetadata extends QueryMetadata {
|
||||
constructor(
|
||||
_selector: Type|string,
|
||||
_selector: Type<any>|string,
|
||||
{descendants = false, read = null}: {descendants?: boolean, read?: any} = {}) {
|
||||
super(_selector, {descendants: descendants, read: read});
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ export class ContentChildrenMetadata extends QueryMetadata {
|
|||
* @stable
|
||||
*/
|
||||
export class ContentChildMetadata extends QueryMetadata {
|
||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
||||
constructor(_selector: Type<any>|string, {read = null}: {read?: any} = {}) {
|
||||
super(_selector, {descendants: true, first: true, read: read});
|
||||
}
|
||||
}
|
||||
|
@ -330,8 +330,8 @@ export class ContentChildMetadata extends QueryMetadata {
|
|||
*/
|
||||
export class ViewQueryMetadata extends QueryMetadata {
|
||||
constructor(
|
||||
_selector: Type|string, {descendants = false, first = false, read = null}:
|
||||
{descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||
_selector: Type<any>|string, {descendants = false, first = false, read = null}:
|
||||
{descendants?: boolean, first?: boolean, read?: any} = {}) {
|
||||
super(_selector, {descendants: descendants, first: first, read: read});
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ export class ViewQueryMetadata extends QueryMetadata {
|
|||
* @stable
|
||||
*/
|
||||
export class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
||||
constructor(_selector: Type<any>|string, {read = null}: {read?: any} = {}) {
|
||||
super(_selector, {descendants: true, read: read});
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ export class ViewChildrenMetadata extends ViewQueryMetadata {
|
|||
* @stable
|
||||
*/
|
||||
export class ViewChildMetadata extends ViewQueryMetadata {
|
||||
constructor(_selector: Type|string, {read = null}: {read?: any} = {}) {
|
||||
constructor(_selector: Type<any>|string, {read = null}: {read?: any} = {}) {
|
||||
super(_selector, {descendants: true, first: true, read: read});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
import {AnimationEntryMetadata} from '../animation/metadata';
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {InjectableMetadata} from '../di/metadata';
|
||||
import {Type, isPresent} from '../facade/lang';
|
||||
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {ViewEncapsulation} from './view';
|
||||
|
||||
/**
|
||||
|
@ -792,11 +792,11 @@ export interface ComponentMetadataType extends DirectiveMetadataType {
|
|||
styleUrls?: string[];
|
||||
styles?: string[];
|
||||
animations?: AnimationEntryMetadata[];
|
||||
directives?: Array<Type|any[]>;
|
||||
pipes?: Array<Type|any[]>;
|
||||
directives?: Array<Type<any>|any[]>;
|
||||
pipes?: Array<Type<any>|any[]>;
|
||||
encapsulation?: ViewEncapsulation;
|
||||
interpolation?: [string, string];
|
||||
entryComponents?: Array<Type|any[]>;
|
||||
entryComponents?: Array<Type<any>|any[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1000,9 +1000,9 @@ export class ComponentMetadata extends DirectiveMetadata implements ComponentMet
|
|||
*/
|
||||
animations: AnimationEntryMetadata[];
|
||||
|
||||
directives: Array<Type|any[]>;
|
||||
directives: Array<Type<any>|any[]>;
|
||||
|
||||
pipes: Array<Type|any[]>;
|
||||
pipes: Array<Type<any>|any[]>;
|
||||
|
||||
/**
|
||||
* Specify how the template and the styles should be encapsulated.
|
||||
|
@ -1020,7 +1020,7 @@ export class ComponentMetadata extends DirectiveMetadata implements ComponentMet
|
|||
* Angular will create a {@link ComponentFactory ComponentFactory} and store it in the
|
||||
* {@link ComponentFactoryResolver ComponentFactoryResolver}.
|
||||
*/
|
||||
entryComponents: Array<Type|any[]>;
|
||||
entryComponents: Array<Type<any>|any[]>;
|
||||
|
||||
constructor({selector,
|
||||
inputs,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {InjectableMetadata} from '../di/metadata';
|
||||
import {Type} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
/**
|
||||
* A wrapper around a module that also includes the providers.
|
||||
|
@ -15,7 +15,7 @@ import {Type} from '../facade/lang';
|
|||
* @experimental
|
||||
*/
|
||||
export interface ModuleWithProviders {
|
||||
ngModule: Type;
|
||||
ngModule: Type<any>;
|
||||
providers?: any[];
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,11 @@ export const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata = {
|
|||
*/
|
||||
export interface NgModuleMetadataType {
|
||||
providers?: any[];
|
||||
declarations?: Array<Type|any[]>;
|
||||
imports?: Array<Type|ModuleWithProviders|any[]>;
|
||||
exports?: Array<Type|any[]>;
|
||||
entryComponents?: Array<Type|any[]>;
|
||||
bootstrap?: Array<Type|any[]>;
|
||||
declarations?: Array<Type<any>|any[]>;
|
||||
imports?: Array<Type<any>|ModuleWithProviders|any[]>;
|
||||
exports?: Array<Type<any>|any[]>;
|
||||
entryComponents?: Array<Type<any>|any[]>;
|
||||
bootstrap?: Array<Type<any>|any[]>;
|
||||
schemas?: Array<SchemaMetadata|any[]>;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
declarations: Array<Type|any[]>;
|
||||
declarations: Array<Type<any>|any[]>;
|
||||
|
||||
/**
|
||||
* Specifies a list of modules whose exported directives/pipes
|
||||
|
@ -118,7 +118,7 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
imports: Array<Type|ModuleWithProviders|any[]>;
|
||||
imports: Array<Type<any>|ModuleWithProviders|any[]>;
|
||||
|
||||
/**
|
||||
* Specifies a list of directives/pipes/module that can be used within the template
|
||||
|
@ -135,7 +135,7 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
exports: Array<Type|any[]>;
|
||||
exports: Array<Type<any>|any[]>;
|
||||
|
||||
/**
|
||||
* Defines the components that should be compiled as well when
|
||||
|
@ -143,14 +143,14 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
|||
* Angular will create a {@link ComponentFactory ComponentFactory} and store it in the
|
||||
* {@link ComponentFactoryResolver ComponentFactoryResolver}.
|
||||
*/
|
||||
entryComponents: Array<Type|any[]>;
|
||||
entryComponents: Array<Type<any>|any[]>;
|
||||
|
||||
/**
|
||||
* Defines the components that should be bootstrapped when
|
||||
* this module is bootstrapped. The components listed here
|
||||
* will automatically be added to `entryComponents`.
|
||||
*/
|
||||
bootstrap: Array<Type|any[]>;
|
||||
bootstrap: Array<Type<any>|any[]>;
|
||||
|
||||
schemas: Array<SchemaMetadata|any[]>;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {AnimationEntryMetadata} from '../animation/metadata';
|
||||
import {Type} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -123,9 +123,9 @@ export class ViewMetadata {
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
directives: Array<Type|any[]>;
|
||||
directives: Array<Type<any>|any[]>;
|
||||
|
||||
pipes: Array<Type|any[]>;
|
||||
pipes: Array<Type<any>|any[]>;
|
||||
|
||||
/**
|
||||
* Specify how the template and the styles should be encapsulated.
|
||||
|
@ -144,8 +144,8 @@ export class ViewMetadata {
|
|||
interpolation}: {
|
||||
templateUrl?: string,
|
||||
template?: string,
|
||||
directives?: Array<Type|any[]>,
|
||||
pipes?: Array<Type|any[]>,
|
||||
directives?: Array<Type<any>|any[]>,
|
||||
pipes?: Array<Type<any>|any[]>,
|
||||
encapsulation?: ViewEncapsulation,
|
||||
styles?: string[],
|
||||
styleUrls?: string[],
|
||||
|
|
|
@ -6,20 +6,19 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../src/facade/lang';
|
||||
|
||||
import {PlatformRef, PlatformRef_, createPlatformFactory} from './application_ref';
|
||||
import {Console} from './console';
|
||||
import {Provider} from './di';
|
||||
import {Reflector, reflector} from './reflection/reflection';
|
||||
import {ReflectorReader} from './reflection/reflector_reader';
|
||||
import {TestabilityRegistry} from './testability/testability';
|
||||
import {Type} from './type';
|
||||
|
||||
function _reflector(): Reflector {
|
||||
return reflector;
|
||||
}
|
||||
|
||||
const _CORE_PLATFORM_PROVIDERS: Array<any|Type|Provider|any[]> = [
|
||||
const _CORE_PLATFORM_PROVIDERS: Array<any|Type<any>|Provider|any[]> = [
|
||||
PlatformRef_, {provide: PlatformRef, useExisting: PlatformRef_},
|
||||
{provide: Reflector, useFactory: _reflector, deps: []},
|
||||
{provide: ReflectorReader, useExisting: Reflector}, TestabilityRegistry, Console
|
||||
|
|
|
@ -6,20 +6,19 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../facade/lang';
|
||||
|
||||
import {Type} from '../type';
|
||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
||||
export interface PlatformReflectionCapabilities {
|
||||
isReflectionEnabled(): boolean;
|
||||
factory(type: Type): Function;
|
||||
interfaces(type: Type): any[];
|
||||
hasLifecycleHook(type: any, lcInterface: /*Type*/ any, lcProperty: string): boolean;
|
||||
parameters(type: any): any[][];
|
||||
annotations(type: any): any[];
|
||||
propMetadata(typeOrFunc: any): {[key: string]: any[]};
|
||||
factory(type: Type<any>): Function;
|
||||
interfaces(type: Type<any>): any[];
|
||||
hasLifecycleHook(type: any, lcInterface: Type<any>, lcProperty: string): boolean;
|
||||
parameters(type: Type<any>): any[][];
|
||||
annotations(type: Type<any>): any[];
|
||||
propMetadata(typeOrFunc: Type<any>): {[key: string]: any[]};
|
||||
getter(name: string): GetterFn;
|
||||
setter(name: string): SetterFn;
|
||||
method(name: string): MethodFn;
|
||||
importUri(type: any): string;
|
||||
importUri(type: Type<any>): string;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {ConcreteType, Type, global, isFunction, isPresent, stringify} from '../facade/lang';
|
||||
import {global, isFunction, isPresent, stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
@ -15,92 +15,17 @@ import {GetterFn, MethodFn, SetterFn} from './types';
|
|||
export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
private _reflect: any;
|
||||
|
||||
constructor(reflect?: any) { this._reflect = isPresent(reflect) ? reflect : global.Reflect; }
|
||||
constructor(reflect?: any) { this._reflect = reflect || global.Reflect; }
|
||||
|
||||
isReflectionEnabled(): boolean { return true; }
|
||||
|
||||
factory(t: ConcreteType<any>): Function {
|
||||
switch (t.length) {
|
||||
case 0:
|
||||
return () => new t();
|
||||
case 1:
|
||||
return (a1: any) => new t(a1);
|
||||
case 2:
|
||||
return (a1: any, a2: any) => new t(a1, a2);
|
||||
case 3:
|
||||
return (a1: any, a2: any, a3: any) => new t(a1, a2, a3);
|
||||
case 4:
|
||||
return (a1: any, a2: any, a3: any, a4: any) => new t(a1, a2, a3, a4);
|
||||
case 5:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any) => new t(a1, a2, a3, a4, a5);
|
||||
case 6:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6);
|
||||
case 7:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7);
|
||||
case 8:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
case 9:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
case 10:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any) => new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
|
||||
case 11:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any) => new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
|
||||
case 12:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
|
||||
case 13:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
|
||||
case 14:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14);
|
||||
case 15:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
|
||||
case 16:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any) =>
|
||||
new t(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16);
|
||||
case 17:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any) =>
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17);
|
||||
case 18:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
||||
a18: any) =>
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
||||
a18);
|
||||
case 19:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
||||
a18: any, a19: any) =>
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
||||
a18, a19);
|
||||
case 20:
|
||||
return (a1: any, a2: any, a3: any, a4: any, a5: any, a6: any, a7: any, a8: any, a9: any,
|
||||
a10: any, a11: any, a12: any, a13: any, a14: any, a15: any, a16: any, a17: any,
|
||||
a18: any, a19: any, a20: any) =>
|
||||
new t(
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17,
|
||||
a18, a19, a20);
|
||||
factory(t: Type<any>): Function {
|
||||
var prototype = t.prototype;
|
||||
return function(...args: any[]) {
|
||||
var instance = Object.create(prototype);
|
||||
t.apply(instance, args);
|
||||
return instance;
|
||||
};
|
||||
|
||||
throw new Error(
|
||||
`Cannot create a factory for '${stringify(t)}' because its constructor has more than 20 arguments`);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
@ -132,7 +57,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
|||
return result;
|
||||
}
|
||||
|
||||
parameters(typeOrFunc: Type): any[][] {
|
||||
parameters(typeOrFunc: Type<any>): any[][] {
|
||||
// Prefer the direct API.
|
||||
if (isPresent((<any>typeOrFunc).parameters)) {
|
||||
return (<any>typeOrFunc).parameters;
|
||||
|
@ -163,7 +88,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
|||
return parameters;
|
||||
}
|
||||
|
||||
annotations(typeOrFunc: Type): any[] {
|
||||
annotations(typeOrFunc: Type<any>): any[] {
|
||||
// Prefer the direct API.
|
||||
if (isPresent((<any>typeOrFunc).annotations)) {
|
||||
var annotations = (<any>typeOrFunc).annotations;
|
||||
|
@ -217,9 +142,9 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
|||
// Note: JavaScript does not support to query for interfaces during runtime.
|
||||
// However, we can't throw here as the reflector will always call this method
|
||||
// when asked for a lifecycle interface as this is what we check in Dart.
|
||||
interfaces(type: Type): any[] { return []; }
|
||||
interfaces(type: Type<any>): any[] { return []; }
|
||||
|
||||
hasLifecycleHook(type: any, lcInterface: Type, lcProperty: string): boolean {
|
||||
hasLifecycleHook(type: any, lcInterface: Type<any>, lcProperty: string): boolean {
|
||||
if (!(type instanceof Type)) return false;
|
||||
|
||||
var proto = (<any>type).prototype;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
import {Map, MapWrapper, Set, SetWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {BaseException} from '../facade/exceptions';
|
||||
import {Type, isPresent} from '../facade/lang';
|
||||
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
import {ReflectorReader} from './reflector_reader';
|
||||
import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
@ -77,7 +77,7 @@ export class Reflector extends ReflectorReader {
|
|||
this._injectableInfo.set(func, funcInfo);
|
||||
}
|
||||
|
||||
registerType(type: Type, typeInfo: ReflectionInfo): void {
|
||||
registerType(type: Type<any>, typeInfo: ReflectionInfo): void {
|
||||
this._injectableInfo.set(type, typeInfo);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ export class Reflector extends ReflectorReader {
|
|||
|
||||
registerMethods(methods: {[key: string]: MethodFn}): void { _mergeMaps(this._methods, methods); }
|
||||
|
||||
factory(type: Type): Function {
|
||||
factory(type: Type<any>): Function {
|
||||
if (this._containsReflectionInfo(type)) {
|
||||
var res = this._getReflectionInfo(type).factory;
|
||||
return isPresent(res) ? res : null;
|
||||
|
@ -96,7 +96,7 @@ export class Reflector extends ReflectorReader {
|
|||
}
|
||||
}
|
||||
|
||||
parameters(typeOrFunc: /*Type*/ any): any[][] {
|
||||
parameters(typeOrFunc: Type<any>): any[][] {
|
||||
if (this._injectableInfo.has(typeOrFunc)) {
|
||||
var res = this._getReflectionInfo(typeOrFunc).parameters;
|
||||
return isPresent(res) ? res : [];
|
||||
|
@ -105,7 +105,7 @@ export class Reflector extends ReflectorReader {
|
|||
}
|
||||
}
|
||||
|
||||
annotations(typeOrFunc: /*Type*/ any): any[] {
|
||||
annotations(typeOrFunc: Type<any>): any[] {
|
||||
if (this._injectableInfo.has(typeOrFunc)) {
|
||||
var res = this._getReflectionInfo(typeOrFunc).annotations;
|
||||
return isPresent(res) ? res : [];
|
||||
|
@ -114,7 +114,7 @@ export class Reflector extends ReflectorReader {
|
|||
}
|
||||
}
|
||||
|
||||
propMetadata(typeOrFunc: /*Type*/ any): {[key: string]: any[]} {
|
||||
propMetadata(typeOrFunc: Type<any>): {[key: string]: any[]} {
|
||||
if (this._injectableInfo.has(typeOrFunc)) {
|
||||
var res = this._getReflectionInfo(typeOrFunc).propMetadata;
|
||||
return isPresent(res) ? res : {};
|
||||
|
@ -123,7 +123,7 @@ export class Reflector extends ReflectorReader {
|
|||
}
|
||||
}
|
||||
|
||||
interfaces(type: /*Type*/ any): any[] {
|
||||
interfaces(type: Type<any>): any[] {
|
||||
if (this._injectableInfo.has(type)) {
|
||||
var res = this._getReflectionInfo(type).interfaces;
|
||||
return isPresent(res) ? res : [];
|
||||
|
@ -132,7 +132,7 @@ export class Reflector extends ReflectorReader {
|
|||
}
|
||||
}
|
||||
|
||||
hasLifecycleHook(type: any, lcInterface: Type, lcProperty: string): boolean {
|
||||
hasLifecycleHook(type: any, lcInterface: Type<any>, lcProperty: string): boolean {
|
||||
var interfaces = this.interfaces(type);
|
||||
if (interfaces.indexOf(lcInterface) !== -1) {
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Runtime representation a type that a Component or other object is instances of.
|
||||
*
|
||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||
* the `MyCustomComponent` constructor function.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export var Type = Function;
|
||||
|
||||
|
||||
export interface Type<T> extends Function { new (...args: any[]): T; }
|
|
@ -6,7 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ConcreteType, Type, global, isFunction, stringify} from '../facade/lang';
|
||||
import {global, isFunction, stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
var _nextClassId = 0;
|
||||
|
||||
|
@ -19,7 +20,7 @@ export interface ClassDefinition {
|
|||
/**
|
||||
* Optional argument for specifying the superclass.
|
||||
*/
|
||||
extends?: Type;
|
||||
extends?: Type<any>;
|
||||
|
||||
/**
|
||||
* Required constructor function for a class.
|
||||
|
@ -36,7 +37,7 @@ export interface ClassDefinition {
|
|||
* Other methods on the class. Note that values should have type 'Function' but TS requires
|
||||
* all properties to have a narrower type than the index signature.
|
||||
*/
|
||||
[x: string]: Type|Function|any[];
|
||||
[x: string]: Type<any>|Function|any[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +67,7 @@ export interface TypeDecorator {
|
|||
/**
|
||||
* Invoke as ES7 decorator.
|
||||
*/
|
||||
<T extends Type>(type: T): T;
|
||||
<T extends Type<any>>(type: T): T;
|
||||
|
||||
// Make TypeDecorator assignable to built-in ParameterDecorator type.
|
||||
// ParameterDecorator is declared in lib.d.ts as a `declare type`
|
||||
|
@ -84,7 +85,7 @@ export interface TypeDecorator {
|
|||
/**
|
||||
* Generate a class from the definition and annotate it with {@link TypeDecorator#annotations}.
|
||||
*/
|
||||
Class(obj: ClassDefinition): ConcreteType<any>;
|
||||
Class(obj: ClassDefinition): Type<any>;
|
||||
}
|
||||
|
||||
function extractAnnotation(annotation: any): any {
|
||||
|
@ -219,7 +220,7 @@ function applyParams(fnOrArray: (Function | any[]), key: string): Function {
|
|||
* ```
|
||||
* @stable
|
||||
*/
|
||||
export function Class(clsDef: ClassDefinition): ConcreteType<any> {
|
||||
export function Class(clsDef: ClassDefinition): Type<any> {
|
||||
const constructor = applyParams(
|
||||
clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
|
||||
let proto = constructor.prototype;
|
||||
|
@ -246,7 +247,7 @@ export function Class(clsDef: ClassDefinition): ConcreteType<any> {
|
|||
(constructor as any)['overriddenName'] = `class${_nextClassId++}`;
|
||||
}
|
||||
|
||||
return <ConcreteType<any>>constructor;
|
||||
return <Type<any>>constructor;
|
||||
}
|
||||
|
||||
var Reflect = global.Reflect;
|
||||
|
@ -268,7 +269,7 @@ export function makeDecorator(annotationCls: any, chainFn: (fn: Function) => voi
|
|||
const chainAnnotation =
|
||||
isFunction(this) && this.annotations instanceof Array ? this.annotations : [];
|
||||
chainAnnotation.push(annotationInstance);
|
||||
const TypeDecorator: TypeDecorator = <TypeDecorator>function TypeDecorator(cls: Type) {
|
||||
const TypeDecorator: TypeDecorator = <TypeDecorator>function TypeDecorator(cls: Type<any>) {
|
||||
const annotations = Reflect.getOwnMetadata('annotations', cls) || [];
|
||||
annotations.push(annotationInstance);
|
||||
Reflect.defineMetadata('annotations', annotations, cls);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ChangeDetectorRef, CompilerFactory, Component, Injector, NgModule, PlatformRef} from '@angular/core';
|
||||
import {APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ChangeDetectorRef, CompilerFactory, Component, Injector, NgModule, PlatformRef, Type} from '@angular/core';
|
||||
import {ApplicationRef, ApplicationRef_} from '@angular/core/src/application_ref';
|
||||
import {Console} from '@angular/core/src/console';
|
||||
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
||||
|
@ -17,7 +17,6 @@ import {expect} from '@angular/platform-browser/testing/matchers';
|
|||
|
||||
import {ExceptionHandler} from '../src/facade/exception_handler';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {ConcreteType} from '../src/facade/lang';
|
||||
import {TestBed, async, inject, withModule} from '../testing';
|
||||
|
||||
import {SpyChangeDetectorRef} from './spies';
|
||||
|
@ -40,9 +39,9 @@ export function main() {
|
|||
|
||||
type CreateModuleOptions = {providers?: any[], ngDoBootstrap?: any, bootstrap?: any[]};
|
||||
|
||||
function createModule(providers?: any[]): ConcreteType<any>;
|
||||
function createModule(options: CreateModuleOptions): ConcreteType<any>;
|
||||
function createModule(providersOrOptions: any[] | CreateModuleOptions): ConcreteType<any> {
|
||||
function createModule(providers?: any[]): Type<any>;
|
||||
function createModule(options: CreateModuleOptions): Type<any>;
|
||||
function createModule(providersOrOptions: any[] | CreateModuleOptions): Type<any> {
|
||||
let options: CreateModuleOptions = {};
|
||||
if (providersOrOptions instanceof Array) {
|
||||
options = {providers: providersOrOptions};
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '@angular/core';
|
||||
import {forwardRef, resolveForwardRef} from '@angular/core/src/di';
|
||||
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {Type} from '../../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
describe('forwardRef', function() {
|
||||
it('should wrap and unwrap the reference', () => {
|
||||
|
|
|
@ -10,7 +10,7 @@ import {AsyncPipe, NgFor} from '@angular/common';
|
|||
import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry';
|
||||
import {TEST_COMPILER_PROVIDERS} from '@angular/compiler/test/test_bindings';
|
||||
import {MockSchemaRegistry} from '@angular/compiler/testing';
|
||||
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, DebugElement, Directive, DoCheck, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, RenderComponentType, Renderer, RootRenderer, SimpleChange, SimpleChanges, TemplateRef, ViewContainerRef, ViewMetadata, WrappedValue, forwardRef} from '@angular/core';
|
||||
import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, DebugElement, Directive, DoCheck, Injectable, Input, OnChanges, OnDestroy, OnInit, Output, Pipe, PipeTransform, RenderComponentType, Renderer, RootRenderer, SimpleChange, SimpleChanges, TemplateRef, Type, ViewContainerRef, ViewMetadata, WrappedValue, forwardRef} from '@angular/core';
|
||||
import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer';
|
||||
import {ComponentFixture, TestBed, TestComponentBuilder, fakeAsync, flushMicrotasks, tick} from '@angular/core/testing';
|
||||
import {afterEach, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
|
||||
|
@ -21,7 +21,7 @@ import {DomRootRenderer} from '@angular/platform-browser/src/dom/dom_renderer';
|
|||
import {EventEmitter} from '../../src/facade/async';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {ConcreteType, NumberWrapper, Type, isBlank} from '../../src/facade/lang';
|
||||
import {NumberWrapper, isBlank} from '../../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
let tcb: TestComponentBuilder;
|
||||
|
@ -30,11 +30,11 @@ export function main() {
|
|||
let directiveLog: DirectiveLog;
|
||||
|
||||
function createCompFixture<T>(template: string): ComponentFixture<TestComponent>;
|
||||
function createCompFixture<T>(template: string, compType: ConcreteType<T>): ComponentFixture<T>;
|
||||
function createCompFixture<T>(template: string, compType: Type<T>): ComponentFixture<T>;
|
||||
function createCompFixture<T>(
|
||||
template: string, compType: ConcreteType<T>, _tcb: TestComponentBuilder): ComponentFixture<T>;
|
||||
template: string, compType: Type<T>, _tcb: TestComponentBuilder): ComponentFixture<T>;
|
||||
function createCompFixture<T>(
|
||||
template: string, compType: ConcreteType<T> = <any>TestComponent,
|
||||
template: string, compType: Type<T> = <any>TestComponent,
|
||||
_tcb: TestComponentBuilder = null): ComponentFixture<T> {
|
||||
if (isBlank(_tcb)) {
|
||||
_tcb = tcb;
|
||||
|
@ -46,28 +46,28 @@ export function main() {
|
|||
.createFakeAsync(compType);
|
||||
}
|
||||
|
||||
function queryDirs(el: DebugElement, dirType: Type): any {
|
||||
function queryDirs(el: DebugElement, dirType: Type<any>): any {
|
||||
var nodes = el.queryAllNodes(By.directive(dirType));
|
||||
return nodes.map(node => node.injector.get(dirType));
|
||||
}
|
||||
|
||||
function _bindSimpleProp<T>(bindAttr: string): ComponentFixture<TestComponent>;
|
||||
function _bindSimpleProp<T>(bindAttr: string, compType: ConcreteType<T>): ComponentFixture<T>;
|
||||
function _bindSimpleProp<T>(bindAttr: string, compType: Type<T>): ComponentFixture<T>;
|
||||
function _bindSimpleProp<T>(
|
||||
bindAttr: string, compType: ConcreteType<T> = <any>TestComponent): ComponentFixture<T> {
|
||||
bindAttr: string, compType: Type<T> = <any>TestComponent): ComponentFixture<T> {
|
||||
var template = `<div ${bindAttr}></div>`;
|
||||
return createCompFixture(template, compType);
|
||||
}
|
||||
|
||||
function _bindSimpleValue(expression: any): ComponentFixture<TestComponent>;
|
||||
function _bindSimpleValue<T>(expression: any, compType: ConcreteType<T>): ComponentFixture<T>;
|
||||
function _bindSimpleValue<T>(expression: any, compType: Type<T>): ComponentFixture<T>;
|
||||
function _bindSimpleValue<T>(
|
||||
expression: any, compType: ConcreteType<T> = <any>TestComponent): ComponentFixture<T> {
|
||||
expression: any, compType: Type<T> = <any>TestComponent): ComponentFixture<T> {
|
||||
return _bindSimpleProp(`[someProp]='${expression}'`, compType);
|
||||
}
|
||||
|
||||
function _bindAndCheckSimpleValue(
|
||||
expression: any, compType: ConcreteType<any> = TestComponent): string[] {
|
||||
expression: any, compType: Type<any> = TestComponent): string[] {
|
||||
const ctx = _bindSimpleValue(expression, compType);
|
||||
ctx.detectChanges(false);
|
||||
return renderLog.log;
|
||||
|
|
|
@ -212,7 +212,7 @@ function createRootElement(doc: any, name: string): any {
|
|||
return rootEl;
|
||||
}
|
||||
|
||||
function filterByDirective(type: Type): Predicate<DebugElement> {
|
||||
function filterByDirective(type: Type<any>): Predicate<DebugElement> {
|
||||
return (debugElement) => { return debugElement.providerTokens.indexOf(type) !== -1; };
|
||||
}
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
import {LowerCasePipe, NgIf} from '@angular/common';
|
||||
import {CompilerConfig, NgModuleResolver} from '@angular/compiler';
|
||||
import {MockNgModuleResolver} from '@angular/compiler/testing';
|
||||
import {ANALYZE_FOR_ENTRY_COMPONENTS, CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, ComponentFactoryResolver, ComponentRef, ComponentResolver, DebugElement, Directive, Host, HostBinding, Inject, Injectable, Injector, Input, ModuleWithProviders, NgModule, NgModuleMetadata, NgModuleRef, OpaqueToken, Optional, Pipe, Provider, ReflectiveInjector, SelfMetadata, SkipSelf, SkipSelfMetadata, ViewMetadata, forwardRef, getDebugNode, provide} from '@angular/core';
|
||||
import {ANALYZE_FOR_ENTRY_COMPONENTS, CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, ComponentFactoryResolver, ComponentResolver, Directive, HostBinding, Inject, Injectable, Injector, Input, NgModule, NgModuleRef, Optional, Pipe, ReflectiveInjector, SelfMetadata, Type, forwardRef, provide} from '@angular/core';
|
||||
import {Console} from '@angular/core/src/console';
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
|
||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {ConcreteType, Type, stringify} from '../../src/facade/lang';
|
||||
import {stringify} from '../../src/facade/lang';
|
||||
import {NgModuleInjector} from '../../src/linker/ng_module_factory';
|
||||
|
||||
class Engine {}
|
||||
|
@ -128,13 +128,11 @@ function declareTests({useJit}: {useJit: boolean}) {
|
|||
injector = _injector;
|
||||
}));
|
||||
|
||||
function createModule<T>(
|
||||
moduleType: ConcreteType<T>, parentInjector: Injector = null): NgModuleRef<T> {
|
||||
function createModule<T>(moduleType: Type<T>, parentInjector: Injector = null): NgModuleRef<T> {
|
||||
return compiler.compileModuleSync(moduleType).create(parentInjector);
|
||||
}
|
||||
|
||||
function createComp<T>(
|
||||
compType: ConcreteType<T>, moduleType: ConcreteType<any>): ComponentFixture<T> {
|
||||
function createComp<T>(compType: Type<T>, moduleType: Type<any>): ComponentFixture<T> {
|
||||
let ngModule = createModule(moduleType);
|
||||
var cf = ngModule.componentFactoryResolver.resolveComponentFactory(compType);
|
||||
return new ComponentFixture(cf.create(injector), null, false);
|
||||
|
|
|
@ -13,7 +13,7 @@ import {beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, x
|
|||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||
|
||||
import {ConcreteType, isBlank} from '../../src/facade/lang';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
|
||||
const ALL_DIRECTIVES = [
|
||||
forwardRef(() => SimpleDirective),
|
||||
|
@ -244,8 +244,7 @@ export function main() {
|
|||
var tcb: TestComponentBuilder;
|
||||
|
||||
function createCompFixture<T>(
|
||||
template: string, tcb: TestComponentBuilder,
|
||||
comp: ConcreteType<T> = null): ComponentFixture<T> {
|
||||
template: string, tcb: TestComponentBuilder, comp: Type<T> = null): ComponentFixture<T> {
|
||||
if (isBlank(comp)) {
|
||||
comp = <any>TestComp;
|
||||
}
|
||||
|
@ -257,7 +256,7 @@ export function main() {
|
|||
}
|
||||
|
||||
function createComp(
|
||||
template: string, tcb: TestComponentBuilder, comp: ConcreteType<any> = null): DebugElement {
|
||||
template: string, tcb: TestComponentBuilder, comp: Type<any> = null): DebugElement {
|
||||
var fixture = createCompFixture(template, tcb, comp);
|
||||
fixture.detectChanges();
|
||||
return fixture.debugElement;
|
||||
|
|
|
@ -23,7 +23,7 @@ export function main() {
|
|||
});
|
||||
|
||||
it('should create type in ES5', () => {
|
||||
function MyComponent(){};
|
||||
class MyComponent {};
|
||||
var as: any /** TODO #9100 */;
|
||||
(<any>MyComponent).annotations = as = Component({});
|
||||
expect(reflector.annotations(MyComponent)).toEqual(as.annotations);
|
||||
|
|
|
@ -141,9 +141,6 @@ export function main() {
|
|||
// clang-format on
|
||||
});
|
||||
|
||||
it('should throw when more than 20 arguments',
|
||||
() => { expect(() => reflector.factory(TestObjWith21Args)).toThrowError(); });
|
||||
|
||||
it('should return a registered factory if available', () => {
|
||||
reflector.registerType(TestObj, new ReflectionInfo(null, null, () => 'fake'));
|
||||
expect(reflector.factory(TestObj)()).toEqual('fake');
|
||||
|
|
|
@ -32,5 +32,5 @@ export class MockApplicationRef extends ApplicationRef {
|
|||
|
||||
tick(): void {}
|
||||
|
||||
get componentTypes(): Type[] { return null; };
|
||||
get componentTypes(): Type<any>[] { return null; };
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {CompilerOptions, ComponentFactory, ComponentMetadataType, ComponentStillLoadingError, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, getPlatform} from '../index';
|
||||
import {CompilerOptions, ComponentFactory, ComponentMetadataType, ComponentStillLoadingError, DirectiveMetadataType, Injector, ModuleWithComponentFactories, NgModule, NgModuleFactory, NgModuleMetadataType, NgModuleRef, NgZone, OpaqueToken, PipeMetadataType, PlatformRef, Provider, ReflectiveInjector, SchemaMetadata, assertPlatform, createPlatform, getPlatform} from '../index';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {ConcreteType, FunctionWrapper, isPresent, stringify} from '../src/facade/lang';
|
||||
|
||||
import {FunctionWrapper, isPresent, stringify} from '../src/facade/lang';
|
||||
import {Type} from '../src/type';
|
||||
import {AsyncTestCompleter} from './async_test_completer';
|
||||
import {ComponentFixture} from './component_fixture';
|
||||
import {MetadataOverride} from './metadata_override';
|
||||
|
@ -63,7 +63,7 @@ export class TestBed implements Injector {
|
|||
*
|
||||
* @experimental
|
||||
*/
|
||||
static initTestEnvironment(ngModule: Type, platform: PlatformRef): TestBed {
|
||||
static initTestEnvironment(ngModule: Type<any>, platform: PlatformRef): TestBed {
|
||||
const testBed = getTestBed();
|
||||
getTestBed().initTestEnvironment(ngModule, platform);
|
||||
return testBed;
|
||||
|
@ -106,34 +106,31 @@ export class TestBed implements Injector {
|
|||
*/
|
||||
static compileComponents(): Promise<any> { return getTestBed().compileComponents(); }
|
||||
|
||||
static overrideModule(
|
||||
ngModule: ConcreteType<any>,
|
||||
override: MetadataOverride<NgModuleMetadataType>): typeof TestBed {
|
||||
static overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>):
|
||||
typeof TestBed {
|
||||
getTestBed().overrideModule(ngModule, override);
|
||||
return TestBed;
|
||||
}
|
||||
|
||||
static overrideComponent(
|
||||
component: ConcreteType<any>,
|
||||
override: MetadataOverride<ComponentMetadataType>): typeof TestBed {
|
||||
static overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>):
|
||||
typeof TestBed {
|
||||
getTestBed().overrideComponent(component, override);
|
||||
return TestBed;
|
||||
}
|
||||
|
||||
static overrideDirective(
|
||||
directive: ConcreteType<any>,
|
||||
override: MetadataOverride<DirectiveMetadataType>): typeof TestBed {
|
||||
static overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>):
|
||||
typeof TestBed {
|
||||
getTestBed().overrideDirective(directive, override);
|
||||
return TestBed;
|
||||
}
|
||||
|
||||
static overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>):
|
||||
static overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>):
|
||||
typeof TestBed {
|
||||
getTestBed().overridePipe(pipe, override);
|
||||
return TestBed;
|
||||
}
|
||||
|
||||
static createComponent<T>(component: ConcreteType<T>): ComponentFixture<T> {
|
||||
static createComponent<T>(component: Type<T>): ComponentFixture<T> {
|
||||
return getTestBed().createComponent(component);
|
||||
}
|
||||
|
||||
|
@ -145,14 +142,14 @@ export class TestBed implements Injector {
|
|||
|
||||
private _compilerOptions: CompilerOptions[] = [];
|
||||
|
||||
private _moduleOverrides: [ConcreteType<any>, MetadataOverride<NgModuleMetadataType>][] = [];
|
||||
private _componentOverrides: [ConcreteType<any>, MetadataOverride<ComponentMetadataType>][] = [];
|
||||
private _directiveOverrides: [ConcreteType<any>, MetadataOverride<DirectiveMetadataType>][] = [];
|
||||
private _pipeOverrides: [ConcreteType<any>, MetadataOverride<PipeMetadataType>][] = [];
|
||||
private _moduleOverrides: [Type<any>, MetadataOverride<NgModuleMetadataType>][] = [];
|
||||
private _componentOverrides: [Type<any>, MetadataOverride<ComponentMetadataType>][] = [];
|
||||
private _directiveOverrides: [Type<any>, MetadataOverride<DirectiveMetadataType>][] = [];
|
||||
private _pipeOverrides: [Type<any>, MetadataOverride<PipeMetadataType>][] = [];
|
||||
|
||||
private _providers: Array<Type|Provider|any[]|any> = [];
|
||||
private _declarations: Array<Type|any[]|any> = [];
|
||||
private _imports: Array<Type|any[]|any> = [];
|
||||
private _providers: Array<Type<any>|Provider|any[]|any> = [];
|
||||
private _declarations: Array<Type<any>|any[]|any> = [];
|
||||
private _imports: Array<Type<any>|any[]|any> = [];
|
||||
private _schemas: Array<SchemaMetadata|any[]> = [];
|
||||
|
||||
/**
|
||||
|
@ -168,7 +165,7 @@ export class TestBed implements Injector {
|
|||
*
|
||||
* @experimental
|
||||
*/
|
||||
initTestEnvironment(ngModule: Type, platform: PlatformRef) {
|
||||
initTestEnvironment(ngModule: Type<any>, platform: PlatformRef) {
|
||||
if (this.platform || this.ngModule) {
|
||||
throw new BaseException('Cannot set base providers because it has already been called');
|
||||
}
|
||||
|
@ -211,7 +208,7 @@ export class TestBed implements Injector {
|
|||
|
||||
platform: PlatformRef = null;
|
||||
|
||||
ngModule: Type = null;
|
||||
ngModule: Type<any> = null;
|
||||
|
||||
configureCompiler(config: {providers?: any[], useJit?: boolean}) {
|
||||
this._assertNotInstantiated('TestBed.configureCompiler', 'configure the compiler');
|
||||
|
@ -270,7 +267,7 @@ export class TestBed implements Injector {
|
|||
this._instantiated = true;
|
||||
}
|
||||
|
||||
private _createCompilerAndModule(): ConcreteType<any> {
|
||||
private _createCompilerAndModule(): Type<any> {
|
||||
const providers = this._providers.concat([{provide: TestBed, useValue: this}]);
|
||||
const declarations = this._declarations;
|
||||
const imports = [this.ngModule, this._imports];
|
||||
|
@ -319,30 +316,27 @@ export class TestBed implements Injector {
|
|||
return FunctionWrapper.apply(fn, params);
|
||||
}
|
||||
|
||||
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>):
|
||||
void {
|
||||
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): void {
|
||||
this._assertNotInstantiated('overrideModule', 'override module metadata');
|
||||
this._moduleOverrides.push([ngModule, override]);
|
||||
}
|
||||
|
||||
overrideComponent(
|
||||
component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
||||
overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): void {
|
||||
this._assertNotInstantiated('overrideComponent', 'override component metadata');
|
||||
this._componentOverrides.push([component, override]);
|
||||
}
|
||||
|
||||
overrideDirective(
|
||||
directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
||||
overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): void {
|
||||
this._assertNotInstantiated('overrideDirective', 'override directive metadata');
|
||||
this._directiveOverrides.push([directive, override]);
|
||||
}
|
||||
|
||||
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>): void {
|
||||
overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): void {
|
||||
this._assertNotInstantiated('overridePipe', 'override pipe metadata');
|
||||
this._pipeOverrides.push([pipe, override]);
|
||||
}
|
||||
|
||||
createComponent<T>(component: ConcreteType<T>): ComponentFixture<T> {
|
||||
createComponent<T>(component: Type<T>): ComponentFixture<T> {
|
||||
this._initIfNeeded();
|
||||
const componentFactory = this._moduleWithComponentFactories.componentFactories.find(
|
||||
(compFactory) => compFactory.componentType === component);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Compiler, CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, NgModuleFactory, NgModuleMetadataType, PipeMetadataType} from '../index';
|
||||
import {Compiler, CompilerOptions, ComponentMetadataType, DirectiveMetadataType, Injector, NgModuleMetadataType, PipeMetadataType} from '../index';
|
||||
import {unimplemented} from '../src/facade/exceptions';
|
||||
import {ConcreteType} from '../src/facade/lang';
|
||||
import {Type} from '../src/type';
|
||||
import {MetadataOverride} from './metadata_override';
|
||||
|
||||
/**
|
||||
|
@ -18,19 +18,18 @@ import {MetadataOverride} from './metadata_override';
|
|||
*/
|
||||
export class TestingCompiler extends Compiler {
|
||||
get injector(): Injector { throw unimplemented(); }
|
||||
overrideModule(module: ConcreteType<any>, overrides: MetadataOverride<NgModuleMetadataType>):
|
||||
overrideModule(module: Type<any>, overrides: MetadataOverride<NgModuleMetadataType>): void {
|
||||
throw unimplemented();
|
||||
}
|
||||
overrideDirective(directive: Type<any>, overrides: MetadataOverride<DirectiveMetadataType>):
|
||||
void {
|
||||
throw unimplemented();
|
||||
}
|
||||
overrideDirective(
|
||||
directive: ConcreteType<any>, overrides: MetadataOverride<DirectiveMetadataType>): void {
|
||||
overrideComponent(component: Type<any>, overrides: MetadataOverride<ComponentMetadataType>):
|
||||
void {
|
||||
throw unimplemented();
|
||||
}
|
||||
overrideComponent(
|
||||
component: ConcreteType<any>, overrides: MetadataOverride<ComponentMetadataType>): void {
|
||||
throw unimplemented();
|
||||
}
|
||||
overridePipe(directive: ConcreteType<any>, overrides: MetadataOverride<PipeMetadataType>): void {
|
||||
overridePipe(directive: Type<any>, overrides: MetadataOverride<PipeMetadataType>): void {
|
||||
throw unimplemented();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
*/
|
||||
|
||||
import {AnimationEntryMetadata, Compiler, ComponentFactory, Injectable, Injector, NgZone, OpaqueToken, ViewMetadata} from '../index';
|
||||
import {ConcreteType, Type, isPresent} from '../src/facade/lang';
|
||||
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
import {Type} from '../src/type';
|
||||
import {ComponentFixture} from './component_fixture';
|
||||
import {tick} from './fake_async';
|
||||
|
||||
|
@ -30,7 +30,7 @@ export class TestComponentBuilder {
|
|||
* Overrides only the html of a {@link ComponentMetadata}.
|
||||
* All the other properties of the component's {@link ViewMetadata} are preserved.
|
||||
*/
|
||||
overrideTemplate(componentType: Type, template: string): TestComponentBuilder {
|
||||
overrideTemplate(componentType: Type<any>, template: string): TestComponentBuilder {
|
||||
throw new Error(
|
||||
'overrideTemplate is not supported in this implementation of TestComponentBuilder.');
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export class TestComponentBuilder {
|
|||
/**
|
||||
* Overrides a component's {@link ViewMetadata}.
|
||||
*/
|
||||
overrideView(componentType: Type, view: ViewMetadata): TestComponentBuilder {
|
||||
overrideView(componentType: Type<any>, view: ViewMetadata): TestComponentBuilder {
|
||||
throw new Error(
|
||||
'overrideView is not supported in this implementation of TestComponentBuilder.');
|
||||
}
|
||||
|
@ -46,7 +46,8 @@ export class TestComponentBuilder {
|
|||
/**
|
||||
* Overrides the directives from the component {@link ViewMetadata}.
|
||||
*/
|
||||
overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder {
|
||||
overrideDirective(componentType: Type<any>, from: Type<any>, to: Type<any>):
|
||||
TestComponentBuilder {
|
||||
throw new Error(
|
||||
'overrideDirective is not supported in this implementation of TestComponentBuilder.');
|
||||
}
|
||||
|
@ -61,7 +62,7 @@ export class TestComponentBuilder {
|
|||
* duplicated providers to
|
||||
* be overridden.
|
||||
*/
|
||||
overrideProviders(type: Type, providers: any[]): TestComponentBuilder {
|
||||
overrideProviders(type: Type<any>, providers: any[]): TestComponentBuilder {
|
||||
throw new Error(
|
||||
'overrideProviders is not supported in this implementation of TestComponentBuilder.');
|
||||
}
|
||||
|
@ -76,12 +77,12 @@ export class TestComponentBuilder {
|
|||
* duplicated providers to
|
||||
* be overridden.
|
||||
*/
|
||||
overrideViewProviders(type: Type, providers: any[]): TestComponentBuilder {
|
||||
overrideViewProviders(type: Type<any>, providers: any[]): TestComponentBuilder {
|
||||
throw new Error(
|
||||
'overrideViewProviders is not supported in this implementation of TestComponentBuilder.');
|
||||
}
|
||||
|
||||
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]):
|
||||
overrideAnimations(componentType: Type<any>, animations: AnimationEntryMetadata[]):
|
||||
TestComponentBuilder {
|
||||
throw new Error(
|
||||
'overrideAnimations is not supported in this implementation of TestComponentBuilder.');
|
||||
|
@ -101,7 +102,7 @@ export class TestComponentBuilder {
|
|||
/**
|
||||
* Builds and returns a ComponentFixture.
|
||||
*/
|
||||
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>> {
|
||||
createAsync<T>(rootComponentType: Type<T>): Promise<ComponentFixture<T>> {
|
||||
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||
let compiler: Compiler = this._injector.get(Compiler);
|
||||
|
@ -115,7 +116,7 @@ export class TestComponentBuilder {
|
|||
return ngZone == null ? initComponent() : ngZone.run(initComponent);
|
||||
}
|
||||
|
||||
createFakeAsync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T> {
|
||||
createFakeAsync<T>(rootComponentType: Type<T>): ComponentFixture<T> {
|
||||
let result: any /** TODO #9100 */;
|
||||
let error: any /** TODO #9100 */;
|
||||
|
||||
|
@ -128,7 +129,7 @@ export class TestComponentBuilder {
|
|||
return result;
|
||||
}
|
||||
|
||||
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T> {
|
||||
createSync<T>(rootComponentType: Type<T>): ComponentFixture<T> {
|
||||
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||
let compiler: Compiler = this._injector.get(Compiler);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {Attribute, Component, Directive, Pipe} from '@angular/core';
|
||||
|
||||
var CustomDirective: Function;
|
||||
class CustomDirective {};
|
||||
|
||||
// #docregion component
|
||||
@Component({selector: 'greet', template: 'Hello {{name}}!', directives: [CustomDirective]})
|
||||
|
|
|
@ -57,25 +57,8 @@ var _global: BrowserNodeGlobal = globalScope;
|
|||
|
||||
export {_global as global};
|
||||
|
||||
/**
|
||||
* Runtime representation a type that a Component or other object is instances of.
|
||||
*
|
||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||
* the `MyCustomComponent` constructor function.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export var Type = Function;
|
||||
|
||||
|
||||
export interface Type extends Function {}
|
||||
|
||||
/**
|
||||
* Runtime representation of a type that is constructable (non-abstract).
|
||||
*/
|
||||
export interface ConcreteType<T> extends Type { new (...args: any[]): T; }
|
||||
|
||||
export function getTypeNameForDebugging(type: Type): string {
|
||||
export function getTypeNameForDebugging(type: any): string {
|
||||
if (type['name']) {
|
||||
return type['name'];
|
||||
}
|
||||
|
@ -426,7 +409,7 @@ export function isPrimitive(obj: any): boolean {
|
|||
return !isJsObject(obj);
|
||||
}
|
||||
|
||||
export function hasConstructor(value: Object, type: Type): boolean {
|
||||
export function hasConstructor(value: Object, type: any): boolean {
|
||||
return value.constructor === type;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,16 +42,16 @@ export {NgSelectOption, SelectControlValueAccessor} from './directives/select_co
|
|||
export {NgSelectMultipleOption, SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor';
|
||||
export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator} from './directives/validators';
|
||||
|
||||
export const SHARED_FORM_DIRECTIVES: Type[] = [
|
||||
export const SHARED_FORM_DIRECTIVES: Type<any>[] = [
|
||||
NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor,
|
||||
CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor,
|
||||
RadioControlValueAccessor, NgControlStatus, RequiredValidator, MinLengthValidator,
|
||||
MaxLengthValidator, PatternValidator
|
||||
];
|
||||
|
||||
export const TEMPLATE_DRIVEN_DIRECTIVES: Type[] = [NgModel, NgModelGroup, NgForm];
|
||||
export const TEMPLATE_DRIVEN_DIRECTIVES: Type<any>[] = [NgModel, NgModelGroup, NgForm];
|
||||
|
||||
export const REACTIVE_DRIVEN_DIRECTIVES: Type[] =
|
||||
export const REACTIVE_DRIVEN_DIRECTIVES: Type<any>[] =
|
||||
[FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
|
||||
|
||||
/**
|
||||
|
@ -71,13 +71,13 @@ export const REACTIVE_DRIVEN_DIRECTIVES: Type[] =
|
|||
* ```
|
||||
* @experimental
|
||||
*/
|
||||
export const FORM_DIRECTIVES: Type[][] = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
|
||||
export const FORM_DIRECTIVES: Type<any>[][] = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
|
||||
export const REACTIVE_FORM_DIRECTIVES: Type[][] =
|
||||
export const REACTIVE_FORM_DIRECTIVES: Type<any>[][] =
|
||||
[REACTIVE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,13 +18,13 @@ import {FormBuilder} from './form_builder';
|
|||
* Shorthand set of providers used for building Angular forms.
|
||||
* @experimental
|
||||
*/
|
||||
export const FORM_PROVIDERS: Type[] = [RadioControlRegistry];
|
||||
export const FORM_PROVIDERS: Type<any>[] = [RadioControlRegistry];
|
||||
|
||||
/**
|
||||
* Shorthand set of providers used for building reactive Angular forms.
|
||||
* @experimental
|
||||
*/
|
||||
export const REACTIVE_FORM_PROVIDERS: Type[] = [FormBuilder, RadioControlRegistry];
|
||||
export const REACTIVE_FORM_PROVIDERS: Type<any>[] = [FormBuilder, RadioControlRegistry];
|
||||
|
||||
/**
|
||||
* The ng module for forms.
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
*/
|
||||
|
||||
import {XHR, analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||
import {ApplicationRef, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, Compiler, CompilerFactory, CompilerOptions, ComponentRef, ComponentResolver, ExceptionHandler, NgModule, NgModuleRef, OpaqueToken, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, ReflectiveInjector, SchemaMetadata, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
|
||||
import {BROWSER_PLATFORM_PROVIDERS, BrowserModule, WORKER_APP_PLATFORM_PROVIDERS, WORKER_SCRIPT, WorkerAppModule, platformBrowser, platformWorkerApp, platformWorkerUi} from '@angular/platform-browser';
|
||||
import {ApplicationRef, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, CompilerFactory, CompilerOptions, ComponentRef, NgModule, PlatformRef, Type, createPlatformFactory} from '@angular/core';
|
||||
import {BrowserModule, WORKER_SCRIPT, WorkerAppModule, platformWorkerUi} from '@angular/platform-browser';
|
||||
|
||||
import {Console} from './core_private';
|
||||
import {ConcreteType, isPresent, stringify} from './src/facade/lang';
|
||||
import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_providers';
|
||||
import {CachedXHR} from './src/xhr/xhr_cache';
|
||||
import {XHRImpl} from './src/xhr/xhr_impl';
|
||||
|
@ -121,7 +120,7 @@ export const browserDynamicPlatform = platformBrowserDynamic;
|
|||
*/
|
||||
// Note: We are using typescript overloads here to have 2 function signatures!
|
||||
export function bootstrap<C>(
|
||||
appComponentType: ConcreteType<C>,
|
||||
appComponentType: Type<C>,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<C>> {
|
||||
let compilerOptions: CompilerOptions;
|
||||
let declarations: any[] = [];
|
||||
|
@ -189,7 +188,7 @@ export const workerAppDynamicPlatform = platformWorkerAppDynamic;
|
|||
* with the {@link workerAppDynamicPlatform}() instead.
|
||||
*/
|
||||
export function bootstrapWorkerApp<T>(
|
||||
appComponentType: ConcreteType<T>,
|
||||
appComponentType: Type<T>,
|
||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
||||
console.warn(
|
||||
'bootstrapWorkerApp is deprecated. Create an @NgModule that includes the `WorkerAppModule` and use `bootstrapModule` with the `workerAppDynamicPlatform()` instead.');
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import {DomAdapter} from '../dom/dom_adapter';
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {Type, isFunction, isPresent} from '../facade/lang';
|
||||
import {isFunction, isPresent} from '../facade/lang';
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {DebugElement} from '@angular/core';
|
||||
import {DebugElement, Type} from '@angular/core';
|
||||
|
||||
import {getDOM} from '../../dom/dom_adapter';
|
||||
import {Predicate} from '../../facade/collection';
|
||||
import {Type, isPresent} from '../../facade/lang';
|
||||
import {isPresent} from '../../facade/lang';
|
||||
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ export class By {
|
|||
*
|
||||
* {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
|
||||
*/
|
||||
static directive(type: Type): Predicate<DebugElement> {
|
||||
static directive(type: Type<any>): Predicate<DebugElement> {
|
||||
return (debugElement) => { return debugElement.providerTokens.indexOf(type) !== -1; };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type, isBlank} from '../facade/lang';
|
||||
import {Type} from '@angular/core';
|
||||
|
||||
import {isBlank} from '../facade/lang';
|
||||
|
||||
var _DOM: DomAdapter = null;
|
||||
|
||||
|
@ -29,7 +31,7 @@ export function setRootDomAdapter(adapter: DomAdapter) {
|
|||
* Provides DOM operations in an environment-agnostic way.
|
||||
*/
|
||||
export abstract class DomAdapter {
|
||||
public xhrType: Type = null;
|
||||
public xhrType: Type<any> = null;
|
||||
abstract hasProperty(element: any /** TODO #9100 */, name: string): boolean;
|
||||
abstract setProperty(el: Element, name: string, value: any): any /** TODO #9100 */;
|
||||
abstract getProperty(el: Element, name: string): any;
|
||||
|
@ -41,7 +43,7 @@ export abstract class DomAdapter {
|
|||
abstract logGroupEnd(): any /** TODO #9100 */;
|
||||
|
||||
/** @deprecated */
|
||||
getXHR(): Type { return this.xhrType; }
|
||||
getXHR(): Type<any> { return this.xhrType; }
|
||||
|
||||
/**
|
||||
* Maps attribute names to their corresponding property names for cases
|
||||
|
|
|
@ -47,7 +47,7 @@ export class ClientMessageBrokerFactory_ extends ClientMessageBrokerFactory {
|
|||
* @experimental WebWorker support in Angular is experimental.
|
||||
*/
|
||||
export abstract class ClientMessageBroker {
|
||||
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
|
||||
abstract runOnService(args: UiArguments, returnType: Type<any>): Promise<any>;
|
||||
}
|
||||
|
||||
interface PromiseCompleter {
|
||||
|
@ -82,7 +82,7 @@ export class ClientMessageBroker_ extends ClientMessageBroker {
|
|||
return id;
|
||||
}
|
||||
|
||||
runOnService(args: UiArguments, returnType: Type): Promise<any> {
|
||||
runOnService(args: UiArguments, returnType: Type<any>): Promise<any> {
|
||||
var fnArgs: any[] /** TODO #9100 */ = [];
|
||||
if (isPresent(args.args)) {
|
||||
args.args.forEach(argument => {
|
||||
|
@ -172,7 +172,7 @@ class MessageData {
|
|||
* @experimental WebWorker support in Angular is experimental.
|
||||
*/
|
||||
export class FnArg {
|
||||
constructor(public value: any /** TODO #9100 */, public type: Type) {}
|
||||
constructor(public value: any /** TODO #9100 */, public type: Type<any>) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException, Injectable, RenderComponentType, ViewEncapsulation} from '@angular/core';
|
||||
import {Injectable, RenderComponentType, Type, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
import {VIEW_ENCAPSULATION_VALUES} from '../../../core_private';
|
||||
import {Map, MapWrapper, StringMapWrapper} from '../../facade/collection';
|
||||
import {Type, isArray, isPresent, serializeEnum} from '../../facade/lang';
|
||||
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {isArray, isPresent, serializeEnum} from '../../facade/lang';
|
||||
import {RenderStore} from './render_store';
|
||||
import {LocationType} from './serialized_types';
|
||||
|
||||
|
@ -22,7 +22,7 @@ import {LocationType} from './serialized_types';
|
|||
/**
|
||||
* @experimental WebWorker support in Angular is currently experimental.
|
||||
*/
|
||||
export const PRIMITIVE: Type = String;
|
||||
export const PRIMITIVE: Type<any> = String;
|
||||
|
||||
@Injectable()
|
||||
export class Serializer {
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, Type} from '@angular/core';
|
||||
|
||||
import {EventEmitter} from '../../facade/async';
|
||||
import {ListWrapper, Map} from '../../facade/collection';
|
||||
import {FunctionWrapper, Type, isPresent} from '../../facade/lang';
|
||||
import {FunctionWrapper, isPresent} from '../../facade/lang';
|
||||
import {MessageBus} from '../shared/message_bus';
|
||||
import {Serializer} from '../shared/serializer';
|
||||
|
||||
|
@ -50,7 +50,7 @@ export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
|
|||
*/
|
||||
export abstract class ServiceMessageBroker {
|
||||
abstract registerMethod(
|
||||
methodName: string, signature: Type[], method: Function, returnType?: Type): void;
|
||||
methodName: string, signature: Type<any>[], method: Function, returnType?: Type<any>): void;
|
||||
}
|
||||
|
||||
export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
||||
|
@ -67,8 +67,8 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
|||
}
|
||||
|
||||
registerMethod(
|
||||
methodName: string, signature: Type[], method: (..._: any[]) => Promise<any>| void,
|
||||
returnType?: Type): void {
|
||||
methodName: string, signature: Type<any>[], method: (..._: any[]) => Promise<any>| void,
|
||||
returnType?: Type<any>): void {
|
||||
this._methods.set(methodName, (message: ReceivedMessage) => {
|
||||
var serializedArgs = message.args;
|
||||
let numArgs = signature === null ? 0 : signature.length;
|
||||
|
@ -92,7 +92,7 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
|||
}
|
||||
}
|
||||
|
||||
private _wrapWebWorkerPromise(id: string, promise: Promise<any>, type: Type): void {
|
||||
private _wrapWebWorkerPromise(id: string, promise: Promise<any>, type: Type<any>): void {
|
||||
promise.then((result: any) => {
|
||||
this._sink.emit(
|
||||
{'type': 'result', 'value': this._serializer.serialize(result, type), 'id': id});
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '@angular/core';
|
||||
|
||||
import {DomAdapter, setRootDomAdapter} from '../../dom/dom_adapter';
|
||||
import {Type} from '../../facade/lang';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -48,7 +50,7 @@ export class WorkerDomAdapter extends DomAdapter {
|
|||
getProperty(el: Element, name: string): any { throw 'not implemented'; }
|
||||
invoke(el: Element, methodName: string, args: any[]): any { throw 'not implemented'; }
|
||||
|
||||
getXHR(): Type { throw 'not implemented'; }
|
||||
getXHR(): Type<any> { throw 'not implemented'; }
|
||||
|
||||
get attrToPropMap(): {[key: string]: string} { throw 'not implemented'; }
|
||||
set attrToPropMap(value: {[key: string]: string}) { throw 'not implemented'; }
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException} from '@angular/core';
|
||||
import {Type} from '@angular/core';
|
||||
import {NgZone} from '@angular/core/src/zone/ng_zone';
|
||||
import {ClientMessageBroker, ClientMessageBrokerFactory_, UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||
import {MessageBus, MessageBusSink, MessageBusSource} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||
|
||||
import {ListWrapper, StringMapWrapper} from '../../../src/facade/collection';
|
||||
import {Type, isPresent} from '../../../src/facade/lang';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {isPresent} from '../../../src/facade/lang';
|
||||
import {SpyMessageBroker} from '../worker/spies';
|
||||
|
||||
import {MockEventEmitter} from './mock_event_emitter';
|
||||
|
@ -46,7 +46,7 @@ export function createPairedMessageBuses(): PairedMessageBuses {
|
|||
export function expectBrokerCall(
|
||||
broker: SpyMessageBroker, methodName: string, vals?: Array<any>,
|
||||
handler?: (..._: any[]) => Promise<any>| void): void {
|
||||
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type) => {
|
||||
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type<any>) => {
|
||||
expect(args.method).toEqual(methodName);
|
||||
if (isPresent(vals)) {
|
||||
expect(args.args.length).toEqual(vals.length);
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '@angular/core';
|
||||
import {AsyncTestCompleter, beforeEach, beforeEachProviders, describe, expect, inject, it} from '@angular/core/testing/testing_internal';
|
||||
import {UiArguments} from '@angular/platform-browser/src/web_workers/shared/client_message_broker';
|
||||
import {MessageBus} from '@angular/platform-browser/src/web_workers/shared/message_bus';
|
||||
import {LocationType} from '@angular/platform-browser/src/web_workers/shared/serialized_types';
|
||||
import {WebWorkerPlatformLocation} from '@angular/platform-browser/src/web_workers/worker/platform_location';
|
||||
import {Type} from '../../../src/facade/lang';
|
||||
|
||||
import {MockMessageBrokerFactory, createPairedMessageBuses, expectBrokerCall} from '../shared/web_worker_test_util';
|
||||
|
||||
import {SpyMessageBroker} from './spies';
|
||||
|
@ -27,7 +28,7 @@ export function main() {
|
|||
|
||||
|
||||
function createWebWorkerPlatformLocation(loc: LocationType): WebWorkerPlatformLocation {
|
||||
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type) => {
|
||||
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type<any>) => {
|
||||
if (args.method === 'getLocation') {
|
||||
return Promise.resolve(loc);
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ var parse5 = require('parse5/index');
|
|||
|
||||
import {ListWrapper, StringMapWrapper} from '../src/facade/collection';
|
||||
import {DomAdapter, setRootDomAdapter} from '../platform_browser_private';
|
||||
import {isPresent, isBlank, global, Type, setValueOnPath, DateWrapper} from '../src/facade/lang';
|
||||
import {BaseException} from '@angular/core';
|
||||
import {isPresent, isBlank, global, setValueOnPath, DateWrapper} from '../src/facade/lang';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {SelectorMatcher, CssSelector} from '../compiler_private';
|
||||
import {Type} from '@angular/core';
|
||||
import {XHR} from '@angular/compiler';
|
||||
|
||||
var parser: any /** TODO #9100 */ = null;
|
||||
|
@ -68,7 +69,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||
|
||||
logGroupEnd() {}
|
||||
|
||||
getXHR(): Type { return XHR; }
|
||||
getXHR(): Type<XHR> { return XHR; }
|
||||
|
||||
get attrToPropMap() { return _attrToPropMap; }
|
||||
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
|
||||
import {PlatformLocation} from '@angular/common';
|
||||
import {analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||
import {ApplicationRef, CompilerFactory, ComponentRef, NgModule, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, Type, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
||||
import {ApplicationRef, ComponentRef, NgModule, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, Type, createPlatformFactory, platformCore} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
|
||||
import {Console, ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
||||
|
||||
import {ConcreteType} from './facade/lang';
|
||||
import {Parse5DomAdapter} from './parse5_adapter';
|
||||
|
||||
function notSupported(feature: string): Error {
|
||||
|
@ -97,7 +96,7 @@ export const serverDynamicPlatform = platformDynamicServer;
|
|||
* instead.
|
||||
*/
|
||||
export function serverBootstrap<T>(
|
||||
appComponentType: ConcreteType<T>,
|
||||
appComponentType: Type<T>,
|
||||
customProviders: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
||||
console.warn(
|
||||
'serverBootstrap is deprecated. Create an @NgModule and use `bootstrapModule` with the `serverDynamicPlatform()` instead.');
|
||||
|
|
|
@ -486,7 +486,7 @@ export interface Route {
|
|||
*/
|
||||
terminal?: boolean;
|
||||
pathMatch?: string;
|
||||
component?: Type|string;
|
||||
component?: Type<any>|string;
|
||||
redirectTo?: string;
|
||||
outlet?: string;
|
||||
canActivate?: any[];
|
||||
|
|
|
@ -36,14 +36,15 @@ class InheritedFromParent {
|
|||
}
|
||||
}
|
||||
|
||||
export function recognize(rootComponentType: Type, config: Routes, urlTree: UrlTree, url: string):
|
||||
Observable<RouterStateSnapshot> {
|
||||
export function recognize(
|
||||
rootComponentType: Type<any>, config: Routes, urlTree: UrlTree,
|
||||
url: string): Observable<RouterStateSnapshot> {
|
||||
return new Recognizer(rootComponentType, config, urlTree, url).recognize();
|
||||
}
|
||||
|
||||
class Recognizer {
|
||||
constructor(
|
||||
private rootComponentType: Type, private config: Routes, private urlTree: UrlTree,
|
||||
private rootComponentType: Type<any>, private config: Routes, private urlTree: UrlTree,
|
||||
private url: string) {}
|
||||
|
||||
recognize(): Observable<RouterStateSnapshot> {
|
||||
|
@ -349,4 +350,4 @@ function getData(route: Route): Data {
|
|||
|
||||
function getResolve(route: Route): ResolveData {
|
||||
return route.resolve ? route.resolve : {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ export class Router {
|
|||
* Creates the router service.
|
||||
*/
|
||||
constructor(
|
||||
private rootComponentType: Type, private resolver: ComponentResolver,
|
||||
private rootComponentType: Type<any>, private resolver: ComponentResolver,
|
||||
private urlSerializer: UrlSerializer, private outletMap: RouterOutletMap,
|
||||
private location: Location, private injector: Injector, loader: NgModuleFactoryLoader,
|
||||
config: Routes) {
|
||||
|
|
|
@ -56,7 +56,7 @@ export class RouterState extends Tree<ActivatedRoute> {
|
|||
toString(): string { return this.snapshot.toString(); }
|
||||
}
|
||||
|
||||
export function createEmptyState(urlTree: UrlTree, rootComponent: Type): RouterState {
|
||||
export function createEmptyState(urlTree: UrlTree, rootComponent: Type<any>): RouterState {
|
||||
const snapshot = createEmptyStateSnapshot(urlTree, rootComponent);
|
||||
const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);
|
||||
const emptyParams = new BehaviorSubject({});
|
||||
|
@ -71,7 +71,7 @@ export function createEmptyState(urlTree: UrlTree, rootComponent: Type): RouterS
|
|||
}
|
||||
|
||||
export function createEmptyStateSnapshot(
|
||||
urlTree: UrlTree, rootComponent: Type): RouterStateSnapshot {
|
||||
urlTree: UrlTree, rootComponent: Type<any>): RouterStateSnapshot {
|
||||
const emptyParams = {};
|
||||
const emptyData = {};
|
||||
const emptyQueryParams = {};
|
||||
|
@ -113,7 +113,7 @@ export class ActivatedRoute {
|
|||
constructor(
|
||||
public url: Observable<UrlSegment[]>, public params: Observable<Params>,
|
||||
public queryParams: Observable<Params>, public fragment: Observable<string>,
|
||||
public data: Observable<Data>, public outlet: string, public component: Type|string,
|
||||
public data: Observable<Data>, public outlet: string, public component: Type<any>|string,
|
||||
futureSnapshot: ActivatedRouteSnapshot) {
|
||||
this._futureSnapshot = futureSnapshot;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ export class ActivatedRouteSnapshot {
|
|||
constructor(
|
||||
public url: UrlSegment[], public params: Params, public queryParams: Params,
|
||||
public fragment: string, public data: Data, public outlet: string,
|
||||
public component: Type|string, routeConfig: Route, urlSegment: UrlSegmentGroup,
|
||||
public component: Type<any>|string, routeConfig: Route, urlSegment: UrlSegmentGroup,
|
||||
lastPathIndex: number, resolve: InheritedResolve) {
|
||||
this._routeConfig = routeConfig;
|
||||
this._urlSegment = urlSegment;
|
||||
|
|
|
@ -25,13 +25,13 @@ export interface AttrProp {
|
|||
}
|
||||
|
||||
export interface ComponentInfo {
|
||||
type: Type;
|
||||
type: Type<any>;
|
||||
selector: string;
|
||||
inputs: AttrProp[];
|
||||
outputs: AttrProp[];
|
||||
}
|
||||
|
||||
export function getComponentInfo(type: Type): ComponentInfo {
|
||||
export function getComponentInfo(type: Type<any>): ComponentInfo {
|
||||
var resolvedMetadata: DirectiveMetadata = directiveResolver.resolve(type);
|
||||
var selector = resolvedMetadata.selector;
|
||||
if (!selector.match(COMPONENT_SELECTOR)) {
|
||||
|
|
|
@ -102,7 +102,7 @@ export class UpgradeAdapter {
|
|||
/* @internal */
|
||||
private idPrefix: string = `NG2_UPGRADE_${upgradeCount++}_`;
|
||||
/* @internal */
|
||||
private upgradedComponents: Type[] = [];
|
||||
private upgradedComponents: Type<any>[] = [];
|
||||
/**
|
||||
* An internal map of ng1 components which need to up upgraded to ng2.
|
||||
*
|
||||
|
@ -113,11 +113,11 @@ export class UpgradeAdapter {
|
|||
*/
|
||||
private ng1ComponentsToBeUpgraded: {[name: string]: UpgradeNg1ComponentAdapterBuilder} = {};
|
||||
/* @internal */
|
||||
private providers: Array<Type|Provider|any[]|any> = [];
|
||||
private providers: Array<Type<any>|Provider|any[]|any> = [];
|
||||
|
||||
// the ng2AppModule param should be required once the deprecated @Component.directives prop is
|
||||
// removed
|
||||
constructor(private ng2AppModule?: Type) {
|
||||
constructor(private ng2AppModule?: Type<any>) {
|
||||
if (arguments.length && !ng2AppModule) {
|
||||
throw new BaseException(
|
||||
'UpgradeAdapter constructor called with undefined instead of a ng module type');
|
||||
|
@ -179,7 +179,7 @@ export class UpgradeAdapter {
|
|||
* });
|
||||
* ```
|
||||
*/
|
||||
downgradeNg2Component(type: Type): Function {
|
||||
downgradeNg2Component(type: Type<any>): Function {
|
||||
this.upgradedComponents.push(type);
|
||||
var info: ComponentInfo = getComponentInfo(type);
|
||||
return ng1ComponentDirective(info, `${this.idPrefix}${info.selector}_c`);
|
||||
|
@ -262,7 +262,7 @@ export class UpgradeAdapter {
|
|||
* });
|
||||
* ```
|
||||
*/
|
||||
upgradeNg1Component(name: string): Type {
|
||||
upgradeNg1Component(name: string): Type<any> {
|
||||
if ((<any>this.ng1ComponentsToBeUpgraded).hasOwnProperty(name)) {
|
||||
return this.ng1ComponentsToBeUpgraded[name].type;
|
||||
} else {
|
||||
|
@ -489,7 +489,9 @@ export class UpgradeAdapter {
|
|||
* @deprecated Use NgModules and `new UpgradeAdapter(ng2AppModule)` to configure top-level
|
||||
*providers
|
||||
*/
|
||||
public addProvider(provider: Type|Provider|any[]|any): void { this.providers.push(provider); }
|
||||
public addProvider(provider: Type<any>|Provider|any[]|any): void {
|
||||
this.providers.push(provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows AngularJS v1 service to be accessible from Angular v2.
|
||||
|
|
|
@ -20,7 +20,7 @@ const NOT_SUPPORTED: any = 'NOT_SUPPORTED';
|
|||
|
||||
|
||||
export class UpgradeNg1ComponentAdapterBuilder {
|
||||
type: Type;
|
||||
type: Type<any>;
|
||||
inputs: string[] = [];
|
||||
inputsRename: string[] = [];
|
||||
outputs: string[] = [];
|
||||
|
|
|
@ -75,7 +75,7 @@ export declare class CheckboxControlValueAccessor implements ControlValueAccesso
|
|||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare const COMMON_DIRECTIVES: Type[][];
|
||||
export declare const COMMON_DIRECTIVES: any[];
|
||||
|
||||
/** @experimental */
|
||||
export declare const COMMON_PIPES: (typeof AsyncPipe | typeof SlicePipe | typeof ReplacePipe | typeof I18nPluralPipe | typeof I18nSelectPipe)[];
|
||||
|
@ -139,7 +139,7 @@ export interface ControlValueAccessor {
|
|||
}
|
||||
|
||||
/** @stable */
|
||||
export declare const CORE_DIRECTIVES: Type[];
|
||||
export declare const CORE_DIRECTIVES: Type<any>[];
|
||||
|
||||
/** @experimental */
|
||||
export declare class CurrencyPipe implements PipeTransform {
|
||||
|
@ -182,10 +182,10 @@ export interface Form {
|
|||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare const FORM_DIRECTIVES: Type[];
|
||||
export declare const FORM_DIRECTIVES: Type<any>[];
|
||||
|
||||
/** @experimental */
|
||||
export declare const FORM_PROVIDERS: Type[];
|
||||
export declare const FORM_PROVIDERS: Type<any>[];
|
||||
|
||||
/** @experimental */
|
||||
export declare class FormBuilder {
|
||||
|
|
|
@ -128,7 +128,7 @@ export declare const APP_ID: any;
|
|||
export declare const APP_INITIALIZER: any;
|
||||
|
||||
/** @deprecated */
|
||||
export declare const APPLICATION_COMMON_PROVIDERS: Array<Type | {
|
||||
export declare const APPLICATION_COMMON_PROVIDERS: Array<Type<any> | {
|
||||
[k: string]: any;
|
||||
} | any[]>;
|
||||
|
||||
|
@ -145,11 +145,11 @@ export declare class ApplicationModule {
|
|||
|
||||
/** @experimental */
|
||||
export declare abstract class ApplicationRef {
|
||||
componentTypes: Type[];
|
||||
componentTypes: Type<any>[];
|
||||
components: ComponentRef<any>[];
|
||||
/** @deprecated */ injector: Injector;
|
||||
/** @deprecated */ zone: NgZone;
|
||||
abstract bootstrap<C>(componentFactory: ComponentFactory<C> | ConcreteType<C>): ComponentRef<C>;
|
||||
abstract bootstrap<C>(componentFactory: ComponentFactory<C> | Type<C>): ComponentRef<C>;
|
||||
/** @deprecated */ abstract dispose(): void;
|
||||
/** @deprecated */ abstract registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void;
|
||||
/** @deprecated */ abstract registerDisposeListener(dispose: () => void): void;
|
||||
|
@ -198,11 +198,11 @@ export declare function bind(token: any): ProviderBuilder;
|
|||
/** @deprecated */
|
||||
export declare class Binding extends Provider {
|
||||
/** @deprecated */ toAlias: any;
|
||||
/** @deprecated */ toClass: Type;
|
||||
/** @deprecated */ toClass: Type<any>;
|
||||
/** @deprecated */ toFactory: Function;
|
||||
/** @deprecated */ toValue: any;
|
||||
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||
toClass?: Type;
|
||||
toClass?: Type<any>;
|
||||
toValue?: any;
|
||||
toAlias?: any;
|
||||
toFactory: Function;
|
||||
|
@ -227,13 +227,13 @@ export declare abstract class ChangeDetectorRef {
|
|||
}
|
||||
|
||||
/** @stable */
|
||||
export declare function Class(clsDef: ClassDefinition): ConcreteType<any>;
|
||||
export declare function Class(clsDef: ClassDefinition): Type<any>;
|
||||
|
||||
/** @stable */
|
||||
export interface ClassDefinition {
|
||||
constructor: Function | any[];
|
||||
extends?: Type;
|
||||
[x: string]: Type | Function | any[];
|
||||
extends?: Type<any>;
|
||||
[x: string]: Type<any> | Function | any[];
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
|
@ -249,13 +249,13 @@ export declare class CollectionChangeRecord {
|
|||
/** @stable */
|
||||
export declare class Compiler {
|
||||
clearCache(): void;
|
||||
clearCacheFor(type: Type): void;
|
||||
compileComponentAsync<T>(component: ConcreteType<T>, ngModule?: Type): Promise<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>>;
|
||||
compileModuleSync<T>(moduleType: ConcreteType<T>): NgModuleFactory<T>;
|
||||
clearCacheFor(type: Type<any>): void;
|
||||
compileComponentAsync<T>(component: Type<T>, ngModule?: Type<any>): Promise<ComponentFactory<T>>;
|
||||
compileComponentSync<T>(component: Type<T>, ngModule?: Type<any>): ComponentFactory<T>;
|
||||
compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>): Promise<ModuleWithComponentFactories<T>>;
|
||||
compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T>;
|
||||
compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>>;
|
||||
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T>;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
@ -283,15 +283,15 @@ export interface ComponentDecorator extends TypeDecorator {
|
|||
|
||||
/** @stable */
|
||||
export declare class ComponentFactory<C> {
|
||||
componentType: Type;
|
||||
componentType: Type<any>;
|
||||
selector: string;
|
||||
constructor(selector: string, _viewFactory: Function, _componentType: Type);
|
||||
constructor(selector: string, _viewFactory: Function, _componentType: Type<any>);
|
||||
create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string | any): ComponentRef<C>;
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export declare abstract class ComponentFactoryResolver {
|
||||
abstract resolveComponentFactory<T>(component: ConcreteType<T>): ComponentFactory<T>;
|
||||
abstract resolveComponentFactory<T>(component: Type<T>): ComponentFactory<T>;
|
||||
static NULL: ComponentFactoryResolver;
|
||||
}
|
||||
|
||||
|
@ -299,12 +299,12 @@ export declare abstract class ComponentFactoryResolver {
|
|||
export declare class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType {
|
||||
animations: AnimationEntryMetadata[];
|
||||
changeDetection: ChangeDetectionStrategy;
|
||||
directives: Array<Type | any[]>;
|
||||
directives: Array<Type<any> | any[]>;
|
||||
encapsulation: ViewEncapsulation;
|
||||
entryComponents: Array<Type | any[]>;
|
||||
entryComponents: Array<Type<any> | any[]>;
|
||||
interpolation: [string, string];
|
||||
moduleId: string;
|
||||
pipes: Array<Type | any[]>;
|
||||
pipes: Array<Type<any> | any[]>;
|
||||
styleUrls: string[];
|
||||
styles: string[];
|
||||
template: string;
|
||||
|
@ -323,12 +323,12 @@ export interface ComponentMetadataFactory {
|
|||
export interface ComponentMetadataType extends DirectiveMetadataType {
|
||||
animations?: AnimationEntryMetadata[];
|
||||
changeDetection?: ChangeDetectionStrategy;
|
||||
directives?: Array<Type | any[]>;
|
||||
directives?: Array<Type<any> | any[]>;
|
||||
encapsulation?: ViewEncapsulation;
|
||||
entryComponents?: Array<Type | any[]>;
|
||||
entryComponents?: Array<Type<any> | any[]>;
|
||||
interpolation?: [string, string];
|
||||
moduleId?: string;
|
||||
pipes?: Array<Type | any[]>;
|
||||
pipes?: Array<Type<any> | any[]>;
|
||||
styleUrls?: string[];
|
||||
styles?: string[];
|
||||
template?: string;
|
||||
|
@ -339,7 +339,7 @@ export interface ComponentMetadataType extends DirectiveMetadataType {
|
|||
/** @stable */
|
||||
export declare abstract class ComponentRef<C> {
|
||||
changeDetectorRef: ChangeDetectorRef;
|
||||
componentType: Type;
|
||||
componentType: Type<any>;
|
||||
hostView: ViewRef;
|
||||
injector: Injector;
|
||||
instance: C;
|
||||
|
@ -351,15 +351,15 @@ export declare abstract class ComponentRef<C> {
|
|||
/** @deprecated */
|
||||
export declare abstract class ComponentResolver {
|
||||
abstract clearCache(): void;
|
||||
abstract resolveComponent(component: Type | string): Promise<ComponentFactory<any>>;
|
||||
abstract resolveComponent(component: Type<any> | string): Promise<ComponentFactory<any>>;
|
||||
static DynamicCompilationDeprecationMsg: string;
|
||||
static LazyLoadingDeprecationMsg: string;
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export declare class ComponentStillLoadingError extends BaseException {
|
||||
compType: Type;
|
||||
constructor(compType: Type);
|
||||
compType: Type<any>;
|
||||
constructor(compType: Type<any>);
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
|
@ -367,17 +367,17 @@ export declare var ContentChild: ContentChildMetadataFactory;
|
|||
|
||||
/** @stable */
|
||||
export declare class ContentChildMetadata extends QueryMetadata {
|
||||
constructor(_selector: Type | string, {read}?: {
|
||||
constructor(_selector: Type<any> | string, {read}?: {
|
||||
read?: any;
|
||||
});
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export interface ContentChildMetadataFactory {
|
||||
(selector: Type | string, {read}?: {
|
||||
(selector: Type<any> | Function | string, {read}?: {
|
||||
read?: any;
|
||||
}): any;
|
||||
new (selector: Type | string, {read}?: {
|
||||
new (selector: Type<any> | Function | string, {read}?: {
|
||||
read?: any;
|
||||
}): ContentChildMetadataFactory;
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ export declare var ContentChildren: ContentChildrenMetadataFactory;
|
|||
|
||||
/** @stable */
|
||||
export declare class ContentChildrenMetadata extends QueryMetadata {
|
||||
constructor(_selector: Type | string, {descendants, read}?: {
|
||||
constructor(_selector: Type<any> | string, {descendants, read}?: {
|
||||
descendants?: boolean;
|
||||
read?: any;
|
||||
});
|
||||
|
@ -395,11 +395,11 @@ export declare class ContentChildrenMetadata extends QueryMetadata {
|
|||
|
||||
/** @stable */
|
||||
export interface ContentChildrenMetadataFactory {
|
||||
(selector: Type | string, {descendants, read}?: {
|
||||
(selector: Type<any> | Function | string, {descendants, read}?: {
|
||||
descendants?: boolean;
|
||||
read?: any;
|
||||
}): any;
|
||||
new (selector: Type | string, {descendants, read}?: {
|
||||
new (selector: Type<any> | Function | string, {descendants, read}?: {
|
||||
descendants?: boolean;
|
||||
read?: any;
|
||||
}): ContentChildrenMetadata;
|
||||
|
@ -409,7 +409,7 @@ export interface ContentChildrenMetadataFactory {
|
|||
export declare function coreBootstrap<C>(componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C>;
|
||||
|
||||
/** @deprecated */
|
||||
export declare function coreLoadAndBootstrap(componentType: Type, injector: Injector): Promise<ComponentRef<any>>;
|
||||
export declare function coreLoadAndBootstrap(componentType: Type<any>, injector: Injector): Promise<ComponentRef<any>>;
|
||||
|
||||
/** @experimental */
|
||||
export declare function createPlatform(injector: Injector): PlatformRef;
|
||||
|
@ -547,8 +547,8 @@ export declare abstract class DoCheck {
|
|||
|
||||
/** @deprecated */
|
||||
export declare abstract class DynamicComponentLoader {
|
||||
abstract loadAsRoot(type: Type, overrideSelectorOrNode: string | any, injector: Injector, onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
abstract loadNextToLocation(type: Type, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[], projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
abstract loadAsRoot(type: Type<any>, overrideSelectorOrNode: string | any, injector: Injector, onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
abstract loadNextToLocation(type: Type<any>, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[], projectableNodes?: any[][]): Promise<ComponentRef<any>>;
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
|
@ -589,7 +589,7 @@ export declare class ExpressionChangedAfterItHasBeenCheckedException extends Bas
|
|||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare function forwardRef(forwardRefFn: ForwardRefFn): Type;
|
||||
export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>;
|
||||
|
||||
/** @experimental */
|
||||
export interface ForwardRefFn {
|
||||
|
@ -792,7 +792,7 @@ export declare class ModuleWithComponentFactories<T> {
|
|||
|
||||
/** @experimental */
|
||||
export interface ModuleWithProviders {
|
||||
ngModule: Type;
|
||||
ngModule: Type<any>;
|
||||
providers?: any[];
|
||||
}
|
||||
|
||||
|
@ -805,10 +805,10 @@ export interface NgModuleDecorator extends TypeDecorator {
|
|||
|
||||
/** @experimental */
|
||||
export declare class NgModuleFactory<T> {
|
||||
moduleType: ConcreteType<T>;
|
||||
moduleType: Type<T>;
|
||||
constructor(_injectorClass: {
|
||||
new (parentInjector: Injector): NgModuleInjector<T>;
|
||||
}, _moduleype: ConcreteType<T>);
|
||||
}, _moduleype: Type<T>);
|
||||
create(parentInjector: Injector): NgModuleRef<T>;
|
||||
}
|
||||
|
||||
|
@ -819,11 +819,11 @@ export declare abstract class NgModuleFactoryLoader {
|
|||
|
||||
/** @experimental */
|
||||
export declare class NgModuleMetadata extends InjectableMetadata implements NgModuleMetadataType {
|
||||
bootstrap: Array<Type | any[]>;
|
||||
declarations: Array<Type | any[]>;
|
||||
entryComponents: Array<Type | any[]>;
|
||||
exports: Array<Type | any[]>;
|
||||
imports: Array<Type | ModuleWithProviders | any[]>;
|
||||
bootstrap: Array<Type<any> | any[]>;
|
||||
declarations: Array<Type<any> | any[]>;
|
||||
entryComponents: Array<Type<any> | any[]>;
|
||||
exports: Array<Type<any> | any[]>;
|
||||
imports: Array<Type<any> | ModuleWithProviders | any[]>;
|
||||
providers: any[];
|
||||
schemas: Array<SchemaMetadata | any[]>;
|
||||
constructor(options?: NgModuleMetadataType);
|
||||
|
@ -837,11 +837,11 @@ export interface NgModuleMetadataFactory {
|
|||
|
||||
/** @experimental */
|
||||
export interface NgModuleMetadataType {
|
||||
bootstrap?: Array<Type | any[]>;
|
||||
declarations?: Array<Type | any[]>;
|
||||
entryComponents?: Array<Type | any[]>;
|
||||
exports?: Array<Type | any[]>;
|
||||
imports?: Array<Type | ModuleWithProviders | any[]>;
|
||||
bootstrap?: Array<Type<any> | any[]>;
|
||||
declarations?: Array<Type<any> | any[]>;
|
||||
entryComponents?: Array<Type<any> | any[]>;
|
||||
exports?: Array<Type<any> | any[]>;
|
||||
imports?: Array<Type<any> | ModuleWithProviders | any[]>;
|
||||
providers?: any[];
|
||||
schemas?: Array<SchemaMetadata | any[]>;
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ export declare class NgZoneError {
|
|||
|
||||
/** @stable */
|
||||
export declare class NoAnnotationError extends BaseException {
|
||||
constructor(typeOrFunc: Type | Function, params: any[][]);
|
||||
constructor(typeOrFunc: Type<any> | Function, params: any[][]);
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
|
@ -1003,7 +1003,7 @@ export declare abstract class PlatformRef {
|
|||
destroyed: boolean;
|
||||
/** @deprecated */ disposed: boolean;
|
||||
injector: Injector;
|
||||
/** @stable */ bootstrapModule<M>(moduleType: ConcreteType<M>, compilerOptions?: CompilerOptions | CompilerOptions[]): Promise<NgModuleRef<M>>;
|
||||
/** @stable */ bootstrapModule<M>(moduleType: Type<M>, compilerOptions?: CompilerOptions | CompilerOptions[]): Promise<NgModuleRef<M>>;
|
||||
/** @experimental */ bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): Promise<NgModuleRef<M>>;
|
||||
abstract destroy(): void;
|
||||
/** @deprecated */ abstract dispose(): void;
|
||||
|
@ -1013,7 +1013,7 @@ export declare abstract class PlatformRef {
|
|||
|
||||
/** @deprecated */
|
||||
export declare function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type;
|
||||
useClass?: Type<any>;
|
||||
useValue?: any;
|
||||
useExisting?: any;
|
||||
useFactory?: Function;
|
||||
|
@ -1026,12 +1026,12 @@ export declare class Provider {
|
|||
dependencies: Object[];
|
||||
multi: boolean;
|
||||
token: any;
|
||||
useClass: Type;
|
||||
useClass: Type<any>;
|
||||
useExisting: any;
|
||||
useFactory: Function;
|
||||
useValue: any;
|
||||
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type;
|
||||
useClass?: Type<any>;
|
||||
useValue?: any;
|
||||
useExisting?: any;
|
||||
useFactory?: Function;
|
||||
|
@ -1045,7 +1045,7 @@ export declare class ProviderBuilder {
|
|||
token: any;
|
||||
constructor(token: any);
|
||||
toAlias(aliasToken: any): Provider;
|
||||
toClass(type: Type): Provider;
|
||||
toClass(type: Type<any>): Provider;
|
||||
toFactory(factory: Function, dependencies?: any[]): Provider;
|
||||
toValue(value: any): Provider;
|
||||
}
|
||||
|
@ -1081,7 +1081,7 @@ export declare class QueryMetadata extends DependencyMetadata {
|
|||
read: any;
|
||||
selector: any;
|
||||
varBindings: string[];
|
||||
constructor(_selector: Type | string, {descendants, first, read}?: {
|
||||
constructor(_selector: Type<any> | string, {descendants, first, read}?: {
|
||||
descendants?: boolean;
|
||||
first?: boolean;
|
||||
read?: any;
|
||||
|
@ -1091,11 +1091,11 @@ export declare class QueryMetadata extends DependencyMetadata {
|
|||
|
||||
/** @deprecated */
|
||||
export interface QueryMetadataFactory {
|
||||
(selector: Type | string, {descendants, read}?: {
|
||||
(selector: Type<any> | Function | string, {descendants, read}?: {
|
||||
descendants?: boolean;
|
||||
read?: any;
|
||||
}): ParameterDecorator;
|
||||
new (selector: Type | string, {descendants, read}?: {
|
||||
new (selector: Type<any> | Function | string, {descendants, read}?: {
|
||||
descendants?: boolean;
|
||||
read?: any;
|
||||
}): QueryMetadata;
|
||||
|
@ -1107,16 +1107,16 @@ export declare abstract class ReflectiveInjector implements Injector {
|
|||
createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
|
||||
abstract get(token: any, notFoundValue?: any): any;
|
||||
instantiateResolved(provider: ResolvedReflectiveProvider): any;
|
||||
resolveAndCreateChild(providers: Array<Type | Provider | {
|
||||
resolveAndCreateChild(providers: Array<Type<any> | Provider | {
|
||||
[k: string]: any;
|
||||
} | any[]>): ReflectiveInjector;
|
||||
resolveAndInstantiate(provider: Type | Provider): any;
|
||||
resolveAndInstantiate(provider: Type<any> | Provider): any;
|
||||
/** @deprecated */ static fromResolvedBindings(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
|
||||
/** @experimental */ static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector;
|
||||
static resolve(providers: Array<Type | Provider | {
|
||||
static resolve(providers: Array<Type<any> | Provider | {
|
||||
[k: string]: any;
|
||||
} | any[]>): ResolvedReflectiveProvider[];
|
||||
static resolveAndCreate(providers: Array<Type | Provider | {
|
||||
static resolveAndCreate(providers: Array<Type<any> | Provider | {
|
||||
[k: string]: any;
|
||||
} | any[]>, parent?: Injector): ReflectiveInjector;
|
||||
}
|
||||
|
@ -1278,14 +1278,14 @@ export declare function style(tokens: string | {
|
|||
export declare class SystemJsCmpFactoryResolver implements ComponentResolver {
|
||||
constructor(_console: Console);
|
||||
clearCache(): void;
|
||||
resolveComponent(componentType: string | Type): Promise<ComponentFactory<any>>;
|
||||
resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export declare class SystemJsComponentResolver implements ComponentResolver {
|
||||
constructor(_resolver: ComponentResolver, _console: Console);
|
||||
clearCache(): void;
|
||||
resolveComponent(componentType: string | Type): Promise<ComponentFactory<any>>;
|
||||
resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
@ -1340,8 +1340,8 @@ export declare var Type: FunctionConstructor;
|
|||
export interface TypeDecorator {
|
||||
annotations: any[];
|
||||
(target: Object, propertyKey?: string | symbol, parameterIndex?: number): void;
|
||||
<T extends Type>(type: T): T;
|
||||
Class(obj: ClassDefinition): ConcreteType<any>;
|
||||
<T extends Type<any>>(type: T): T;
|
||||
Class(obj: ClassDefinition): Type<any>;
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
|
@ -1349,17 +1349,17 @@ export declare var ViewChild: ViewChildMetadataFactory;
|
|||
|
||||
/** @stable */
|
||||
export declare class ViewChildMetadata extends ViewQueryMetadata {
|
||||
constructor(_selector: Type | string, {read}?: {
|
||||
constructor(_selector: Type<any> | string, {read}?: {
|
||||
read?: any;
|
||||
});
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export interface ViewChildMetadataFactory {
|
||||
(selector: Type | string, {read}?: {
|
||||
(selector: Type<any> | Function | string, {read}?: {
|
||||
read?: any;
|
||||
}): any;
|
||||
new (selector: Type | string, {read}?: {
|
||||
new (selector: Type<any> | Function | string, {read}?: {
|
||||
read?: any;
|
||||
}): ViewChildMetadataFactory;
|
||||
}
|
||||
|
@ -1369,17 +1369,17 @@ export declare var ViewChildren: ViewChildrenMetadataFactory;
|
|||
|
||||
/** @stable */
|
||||
export declare class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||
constructor(_selector: Type | string, {read}?: {
|
||||
constructor(_selector: Type<any> | string, {read}?: {
|
||||
read?: any;
|
||||
});
|
||||
}
|
||||
|
||||
/** @stable */
|
||||
export interface ViewChildrenMetadataFactory {
|
||||
(selector: Type | string, {read}?: {
|
||||
(selector: Type<any> | Function | string, {read}?: {
|
||||
read?: any;
|
||||
}): any;
|
||||
new (selector: Type | string, {read}?: {
|
||||
new (selector: Type<any> | Function | string, {read}?: {
|
||||
read?: any;
|
||||
}): ViewChildrenMetadata;
|
||||
}
|
||||
|
@ -1411,10 +1411,10 @@ export declare enum ViewEncapsulation {
|
|||
/** @deprecated */
|
||||
export declare class ViewMetadata {
|
||||
animations: AnimationEntryMetadata[];
|
||||
directives: Array<Type | any[]>;
|
||||
directives: Array<Type<any> | any[]>;
|
||||
encapsulation: ViewEncapsulation;
|
||||
interpolation: [string, string];
|
||||
pipes: Array<Type | any[]>;
|
||||
pipes: Array<Type<any> | any[]>;
|
||||
styleUrls: string[];
|
||||
styles: string[];
|
||||
template: string;
|
||||
|
@ -1422,8 +1422,8 @@ export declare class ViewMetadata {
|
|||
constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls, animations, interpolation}?: {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
directives?: Array<Type | any[]>;
|
||||
pipes?: Array<Type | any[]>;
|
||||
directives?: Array<Type<any> | any[]>;
|
||||
pipes?: Array<Type<any> | any[]>;
|
||||
encapsulation?: ViewEncapsulation;
|
||||
styles?: string[];
|
||||
styleUrls?: string[];
|
||||
|
@ -1438,7 +1438,7 @@ export declare var ViewQuery: QueryMetadataFactory;
|
|||
/** @deprecated */
|
||||
export declare class ViewQueryMetadata extends QueryMetadata {
|
||||
isViewQuery: boolean;
|
||||
constructor(_selector: Type | string, {descendants, first, read}?: {
|
||||
constructor(_selector: Type<any> | string, {descendants, first, read}?: {
|
||||
descendants?: boolean;
|
||||
first?: boolean;
|
||||
read?: any;
|
||||
|
|
|
@ -61,7 +61,7 @@ export declare function resetFakeAsyncZone(): void;
|
|||
|
||||
/** @experimental */
|
||||
export declare class TestBed implements Injector {
|
||||
ngModule: Type;
|
||||
ngModule: Type<any>;
|
||||
platform: PlatformRef;
|
||||
compileComponents(): Promise<any>;
|
||||
configureCompiler(config: {
|
||||
|
@ -69,14 +69,14 @@ export declare class TestBed implements Injector {
|
|||
useJit?: boolean;
|
||||
}): void;
|
||||
configureTestingModule(moduleDef: TestModuleMetadata): void;
|
||||
createComponent<T>(component: ConcreteType<T>): ComponentFixture<T>;
|
||||
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||
execute(tokens: any[], fn: Function): any;
|
||||
get(token: any, notFoundValue?: any): any;
|
||||
/** @experimental */ initTestEnvironment(ngModule: Type, platform: PlatformRef): 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;
|
||||
/** @experimental */ initTestEnvironment(ngModule: Type<any>, platform: PlatformRef): void;
|
||||
overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): void;
|
||||
overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): void;
|
||||
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): void;
|
||||
overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): void;
|
||||
/** @deprecated */ reset(): void;
|
||||
/** @experimental */ resetTestEnvironment(): void;
|
||||
resetTestingModule(): void;
|
||||
|
@ -86,12 +86,12 @@ export declare class TestBed implements Injector {
|
|||
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;
|
||||
static createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
||||
/** @experimental */ static initTestEnvironment(ngModule: Type<any>, platform: PlatformRef): TestBed;
|
||||
static overrideComponent(component: Type<any>, override: MetadataOverride<ComponentMetadataType>): typeof TestBed;
|
||||
static overrideDirective(directive: Type<any>, override: MetadataOverride<DirectiveMetadataType>): typeof TestBed;
|
||||
static overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModuleMetadataType>): typeof TestBed;
|
||||
static overridePipe(pipe: Type<any>, override: MetadataOverride<PipeMetadataType>): typeof TestBed;
|
||||
/** @experimental */ static resetTestEnvironment(): void;
|
||||
static resetTestingModule(): typeof TestBed;
|
||||
}
|
||||
|
@ -100,16 +100,16 @@ export declare class TestBed implements Injector {
|
|||
export declare class TestComponentBuilder {
|
||||
protected _injector: Injector;
|
||||
constructor(_injector: Injector);
|
||||
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>>;
|
||||
createFakeAsync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T>;
|
||||
createAsync<T>(rootComponentType: Type<T>): Promise<ComponentFixture<T>>;
|
||||
createFakeAsync<T>(rootComponentType: Type<T>): ComponentFixture<T>;
|
||||
protected createFromFactory<C>(ngZone: NgZone, componentFactory: ComponentFactory<C>): ComponentFixture<C>;
|
||||
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T>;
|
||||
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]): TestComponentBuilder;
|
||||
overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder;
|
||||
overrideProviders(type: Type, providers: any[]): TestComponentBuilder;
|
||||
overrideTemplate(componentType: Type, template: string): TestComponentBuilder;
|
||||
overrideView(componentType: Type, view: ViewMetadata): TestComponentBuilder;
|
||||
overrideViewProviders(type: Type, providers: any[]): TestComponentBuilder;
|
||||
createSync<T>(rootComponentType: Type<T>): ComponentFixture<T>;
|
||||
overrideAnimations(componentType: Type<any>, animations: AnimationEntryMetadata[]): TestComponentBuilder;
|
||||
overrideDirective(componentType: Type<any>, from: Type<any>, to: Type<any>): TestComponentBuilder;
|
||||
overrideProviders(type: Type<any>, providers: any[]): TestComponentBuilder;
|
||||
overrideTemplate(componentType: Type<any>, template: string): TestComponentBuilder;
|
||||
overrideView(componentType: Type<any>, view: ViewMetadata): TestComponentBuilder;
|
||||
overrideViewProviders(type: Type<any>, providers: any[]): TestComponentBuilder;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
|
|
@ -141,10 +141,10 @@ export interface Form {
|
|||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare const FORM_DIRECTIVES: Type[][];
|
||||
export declare const FORM_DIRECTIVES: Type<any>[][];
|
||||
|
||||
/** @experimental */
|
||||
export declare const FORM_PROVIDERS: Type[];
|
||||
export declare const FORM_PROVIDERS: Type<any>[];
|
||||
|
||||
/** @experimental */
|
||||
export declare class FormArray extends AbstractControl {
|
||||
|
@ -433,10 +433,10 @@ export declare class PatternValidator implements Validator {
|
|||
export declare function provideForms(): any[];
|
||||
|
||||
/** @experimental */
|
||||
export declare const REACTIVE_FORM_DIRECTIVES: Type[][];
|
||||
export declare const REACTIVE_FORM_DIRECTIVES: Type<any>[][];
|
||||
|
||||
/** @experimental */
|
||||
export declare const REACTIVE_FORM_PROVIDERS: Type[];
|
||||
export declare const REACTIVE_FORM_PROVIDERS: Type<any>[];
|
||||
|
||||
/** @experimental */
|
||||
export declare class ReactiveFormsModule {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/** @deprecated */
|
||||
export declare function bootstrap<C>(appComponentType: ConcreteType<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
||||
export declare function bootstrap<C>(appComponentType: Type<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
||||
|
||||
/** @deprecated */
|
||||
export declare function bootstrapWorkerApp<T>(appComponentType: ConcreteType<T>, customProviders?: Array<any>): Promise<ComponentRef<T>>;
|
||||
export declare function bootstrapWorkerApp<T>(appComponentType: Type<T>, customProviders?: Array<any>): Promise<ComponentRef<T>>;
|
||||
|
||||
/** @experimental */
|
||||
export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: Array<any>): Promise<PlatformRef>;
|
||||
|
|
|
@ -42,12 +42,12 @@ export declare class BrowserPlatformLocation extends PlatformLocation {
|
|||
export declare class By {
|
||||
static all(): Predicate<DebugElement>;
|
||||
static css(selector: string): Predicate<DebugElement>;
|
||||
static directive(type: Type): Predicate<DebugElement>;
|
||||
static directive(type: Type<any>): Predicate<DebugElement>;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare abstract class ClientMessageBroker {
|
||||
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
|
||||
abstract runOnService(args: UiArguments, returnType: Type<any>): Promise<any>;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
@ -87,9 +87,9 @@ export declare class EventManager {
|
|||
|
||||
/** @experimental */
|
||||
export declare class FnArg {
|
||||
type: Type;
|
||||
type: Type<any>;
|
||||
value: any;
|
||||
constructor(value: any, type: Type);
|
||||
constructor(value: any, type: Type<any>);
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
@ -136,7 +136,7 @@ export declare const platformWorkerApp: (extraProviders?: any[]) => PlatformRef;
|
|||
export declare const platformWorkerUi: (extraProviders?: any[]) => PlatformRef;
|
||||
|
||||
/** @experimental */
|
||||
export declare const PRIMITIVE: Type;
|
||||
export declare const PRIMITIVE: Type<any>;
|
||||
|
||||
/** @experimental */
|
||||
export declare class ReceivedMessage {
|
||||
|
@ -171,7 +171,7 @@ export interface SafeUrl extends SafeValue {
|
|||
|
||||
/** @experimental */
|
||||
export declare abstract class ServiceMessageBroker {
|
||||
abstract registerMethod(methodName: string, signature: Type[], method: Function, returnType?: Type): void;
|
||||
abstract registerMethod(methodName: string, signature: Type<any>[], method: Function, returnType?: Type<any>): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
|
|
|
@ -8,7 +8,7 @@ export declare const platformServer: (extraProviders?: any[]) => PlatformRef;
|
|||
export declare const SERVER_PLATFORM_PROVIDERS: Array<any>;
|
||||
|
||||
/** @deprecated */
|
||||
export declare function serverBootstrap<T>(appComponentType: ConcreteType<T>, customProviders: Array<any>): Promise<ComponentRef<T>>;
|
||||
export declare function serverBootstrap<T>(appComponentType: Type<T>, customProviders: Array<any>): Promise<ComponentRef<T>>;
|
||||
|
||||
/** @deprecated */
|
||||
export declare const serverDynamicPlatform: (extraProviders?: any[]) => PlatformRef;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @stable */
|
||||
export declare class ActivatedRoute {
|
||||
children: ActivatedRoute[];
|
||||
component: Type | string;
|
||||
component: Type<any> | string;
|
||||
data: Observable<Data>;
|
||||
firstChild: ActivatedRoute;
|
||||
fragment: Observable<string>;
|
||||
|
@ -20,7 +20,7 @@ export declare class ActivatedRoute {
|
|||
/** @stable */
|
||||
export declare class ActivatedRouteSnapshot {
|
||||
children: ActivatedRouteSnapshot[];
|
||||
component: Type | string;
|
||||
component: Type<any> | string;
|
||||
data: Data;
|
||||
firstChild: ActivatedRouteSnapshot;
|
||||
fragment: string;
|
||||
|
@ -153,7 +153,7 @@ export interface Route {
|
|||
canDeactivate?: any[];
|
||||
canLoad?: any[];
|
||||
children?: Route[];
|
||||
component?: Type | string;
|
||||
component?: Type<any> | string;
|
||||
data?: Data;
|
||||
loadChildren?: string;
|
||||
outlet?: string;
|
||||
|
@ -170,7 +170,7 @@ export declare class Router {
|
|||
/** @experimental */ navigated: boolean;
|
||||
routerState: RouterState;
|
||||
url: string;
|
||||
constructor(rootComponentType: Type, resolver: ComponentResolver, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location, injector: Injector, loader: NgModuleFactoryLoader, config: Routes);
|
||||
constructor(rootComponentType: Type<any>, resolver: ComponentResolver, urlSerializer: UrlSerializer, outletMap: RouterOutletMap, location: Location, injector: Injector, loader: NgModuleFactoryLoader, config: Routes);
|
||||
createUrlTree(commands: any[], {relativeTo, queryParams, fragment, preserveQueryParams, preserveFragment}?: NavigationExtras): UrlTree;
|
||||
dispose(): void;
|
||||
initialNavigation(): void;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/** @experimental */
|
||||
export declare class UpgradeAdapter {
|
||||
constructor(ng2AppModule?: Type);
|
||||
/** @deprecated */ addProvider(provider: Type | Provider | any[] | any): void;
|
||||
constructor(ng2AppModule?: Type<any>);
|
||||
/** @deprecated */ addProvider(provider: Type<any> | Provider | any[] | any): void;
|
||||
bootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef;
|
||||
downgradeNg2Component(type: Type): Function;
|
||||
downgradeNg2Component(type: Type<any>): Function;
|
||||
downgradeNg2Provider(token: any): Function;
|
||||
upgradeNg1Component(name: string): Type;
|
||||
upgradeNg1Component(name: string): Type<any>;
|
||||
upgradeNg1Provider(name: string, options?: {
|
||||
asToken: any;
|
||||
}): void;
|
||||
|
|
Loading…
Reference in New Issue