@ -346,8 +346,8 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
zone.run(() => { this._exceptionHandler = _injector.get(ExceptionHandler); });
|
||||
this._asyncInitDonePromise = this.run(() => {
|
||||
let inits: Function[] = _injector.get(APP_INITIALIZER, null);
|
||||
var asyncInitResults: any[] /** TODO #9100 */ = [];
|
||||
var asyncInitDonePromise: any /** TODO #9100 */;
|
||||
var asyncInitResults: Promise<any>[] = [];
|
||||
var asyncInitDonePromise: Promise<any>;
|
||||
if (isPresent(inits)) {
|
||||
for (var i = 0; i < inits.length; i++) {
|
||||
var initResult = inits[i]();
|
||||
@ -391,7 +391,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
|
||||
run(callback: Function): any {
|
||||
var zone = this.injector.get(NgZone);
|
||||
var result: any /** TODO #9100 */;
|
||||
var result: any;
|
||||
// Note: Don't use zone.runGuarded as we want to know about
|
||||
// the thrown exception!
|
||||
// Note: the completer needs to be created outside
|
||||
|
@ -51,7 +51,7 @@ import {stringify} from '../facade/lang';
|
||||
* @stable
|
||||
*/
|
||||
export class InjectMetadata {
|
||||
constructor(public token: any /** TODO #9100 */) {}
|
||||
constructor(public token: any) {}
|
||||
toString(): string { return `@Inject(${stringify(this.token)})`; }
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ export class OptionalMetadata {
|
||||
* @stable
|
||||
*/
|
||||
export class DependencyMetadata {
|
||||
get token(): any /** TODO #9100 */ { return null; }
|
||||
get token(): any { return null; }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ export class Provider {
|
||||
/**
|
||||
* Token used when retrieving this provider. Usually, it is a type {@link Type}.
|
||||
*/
|
||||
token: any /** TODO #9100 */;
|
||||
token: any;
|
||||
|
||||
/**
|
||||
* Binds a DI token to an implementation class.
|
||||
@ -77,7 +77,7 @@ export class Provider {
|
||||
* expect(injector.get("message")).toEqual('Hello');
|
||||
* ```
|
||||
*/
|
||||
useValue: any /** TODO #9100 */;
|
||||
useValue: any;
|
||||
|
||||
/**
|
||||
* Binds a DI token to an existing token.
|
||||
@ -111,7 +111,7 @@ export class Provider {
|
||||
* expect(injectorClass.get(Vehicle) instanceof Car).toBe(true);
|
||||
* ```
|
||||
*/
|
||||
useExisting: any /** TODO #9100 */;
|
||||
useExisting: any;
|
||||
|
||||
/**
|
||||
* Binds a DI token to a function which computes the value.
|
||||
@ -157,15 +157,14 @@ export class Provider {
|
||||
/** @internal */
|
||||
_multi: boolean;
|
||||
|
||||
constructor(
|
||||
token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}) {
|
||||
constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}) {
|
||||
this.token = token;
|
||||
this.useClass = useClass;
|
||||
this.useValue = useValue;
|
||||
@ -215,7 +214,7 @@ export class Provider {
|
||||
* @ts2dart_const
|
||||
*/
|
||||
export class Binding extends Provider {
|
||||
constructor(token: any /** TODO #9100 */, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||
toClass?: Type,
|
||||
toValue?: any,
|
||||
toAlias?: any,
|
||||
@ -264,7 +263,7 @@ export class Binding extends Provider {
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
export function bind(token: any /** TODO #9100 */): ProviderBuilder {
|
||||
export function bind(token: any): ProviderBuilder {
|
||||
return new ProviderBuilder(token);
|
||||
}
|
||||
|
||||
@ -273,7 +272,7 @@ export function bind(token: any /** TODO #9100 */): ProviderBuilder {
|
||||
* @deprecated
|
||||
*/
|
||||
export class ProviderBuilder {
|
||||
constructor(public token: any /** TODO #9100 */) {}
|
||||
constructor(public token: any) {}
|
||||
|
||||
/**
|
||||
* Binds a DI token to a class.
|
||||
@ -398,15 +397,14 @@ export class ProviderBuilder {
|
||||
* <!-- TODO: improve the docs -->
|
||||
* @deprecated
|
||||
*/
|
||||
export function provide(
|
||||
token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}): Provider {
|
||||
export function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
useFactory?: Function,
|
||||
deps?: Object[],
|
||||
multi?: boolean
|
||||
}): Provider {
|
||||
return new Provider(token, {
|
||||
useClass: useClass,
|
||||
useValue: useValue,
|
||||
|
@ -8,20 +8,20 @@
|
||||
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {BaseException, WrappedException} from '../facade/exceptions';
|
||||
import {isBlank, stringify} from '../facade/lang';
|
||||
import {Type, isBlank, stringify} from '../facade/lang';
|
||||
|
||||
import {Provider} from './provider';
|
||||
import {ReflectiveInjector} from './reflective_injector';
|
||||
import {ReflectiveKey} from './reflective_key';
|
||||
|
||||
function findFirstClosedCycle(keys: any[]): any[] {
|
||||
var res: any[] /** TODO #9100 */ = [];
|
||||
var res: any[] = [];
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
if (ListWrapper.contains(res, keys[i])) {
|
||||
res.push(keys[i]);
|
||||
return res;
|
||||
} else {
|
||||
res.push(keys[i]);
|
||||
}
|
||||
res.push(keys[i]);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -31,9 +31,9 @@ function constructResolvingPath(keys: any[]): string {
|
||||
var reversed = findFirstClosedCycle(ListWrapper.reversed(keys));
|
||||
var tokenStrs = reversed.map(k => stringify(k.token));
|
||||
return ' (' + tokenStrs.join(' -> ') + ')';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
@ -156,8 +156,8 @@ export class InstantiationError extends WrappedException {
|
||||
injectors: ReflectiveInjector[];
|
||||
|
||||
constructor(
|
||||
injector: ReflectiveInjector, originalException: any /** TODO #9100 */,
|
||||
originalStack: any /** TODO #9100 */, key: ReflectiveKey) {
|
||||
injector: ReflectiveInjector, originalException: any, originalStack: any,
|
||||
key: ReflectiveKey) {
|
||||
super('DI Exception', originalException, originalStack, null);
|
||||
this.keys = [key];
|
||||
this.injectors = [injector];
|
||||
@ -190,7 +190,7 @@ export class InstantiationError extends WrappedException {
|
||||
* @stable
|
||||
*/
|
||||
export class InvalidProviderError extends BaseException {
|
||||
constructor(provider: any /** TODO #9100 */) {
|
||||
constructor(provider: any) {
|
||||
super(`Invalid provider - only instances of Provider and Type are allowed, got: ${provider}`);
|
||||
}
|
||||
}
|
||||
@ -225,12 +225,12 @@ export class InvalidProviderError extends BaseException {
|
||||
* @stable
|
||||
*/
|
||||
export class NoAnnotationError extends BaseException {
|
||||
constructor(typeOrFunc: any /** TODO #9100 */, params: any[][]) {
|
||||
constructor(typeOrFunc: Type|Function, params: any[][]) {
|
||||
super(NoAnnotationError._genMessage(typeOrFunc, params));
|
||||
}
|
||||
|
||||
private static _genMessage(typeOrFunc: any /** TODO #9100 */, params: any[][]) {
|
||||
var signature: any[] /** TODO #9100 */ = [];
|
||||
private static _genMessage(typeOrFunc: Type|Function, params: any[][]) {
|
||||
var signature: string[] = [];
|
||||
for (var i = 0, ii = params.length; i < ii; i++) {
|
||||
var parameter = params[i];
|
||||
if (isBlank(parameter) || parameter.length == 0) {
|
||||
@ -261,7 +261,7 @@ export class NoAnnotationError extends BaseException {
|
||||
* @stable
|
||||
*/
|
||||
export class OutOfBoundsError extends BaseException {
|
||||
constructor(index: any /** TODO #9100 */) { super(`Index ${index} is out-of-bounds.`); }
|
||||
constructor(index: number) { super(`Index ${index} is out-of-bounds.`); }
|
||||
}
|
||||
|
||||
// TODO: add a working example after alpha38 is released
|
||||
@ -278,7 +278,7 @@ export class OutOfBoundsError extends BaseException {
|
||||
* ```
|
||||
*/
|
||||
export class MixingMultiProvidersWithRegularProvidersError extends BaseException {
|
||||
constructor(provider1: any /** TODO #9100 */, provider2: any /** TODO #9100 */) {
|
||||
constructor(provider1: any, provider2: any) {
|
||||
super(
|
||||
'Cannot mix multi providers and regular providers, got: ' + provider1.toString() + ' ' +
|
||||
provider2.toString());
|
||||
|
@ -739,7 +739,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
throw e;
|
||||
}
|
||||
|
||||
var obj: any /** TODO #9100 */;
|
||||
var obj: any;
|
||||
try {
|
||||
switch (length) {
|
||||
case 0:
|
||||
@ -892,9 +892,9 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
var INJECTOR_KEY = ReflectiveKey.get(Injector);
|
||||
|
||||
function _mapProviders(injector: ReflectiveInjector_, fn: Function): any[] {
|
||||
var res: any[] /** TODO #9100 */ = [];
|
||||
var res: any[] = new Array(injector._proto.numberOfProviders);
|
||||
for (var i = 0; i < injector._proto.numberOfProviders; ++i) {
|
||||
res.push(fn(injector._proto.getProviderAtIndex(i)));
|
||||
res[i] = fn(injector._proto.getProviderAtIndex(i));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export class ReflectiveDependency {
|
||||
}
|
||||
}
|
||||
|
||||
const _EMPTY_LIST: any[] /** TODO #9100 */ = /*@ts2dart_const*/[];
|
||||
const _EMPTY_LIST: any[] = /*@ts2dart_const*/[];
|
||||
|
||||
/**
|
||||
* An internal resolved representation of a {@link Provider} used by the {@link Injector}.
|
||||
@ -105,13 +105,13 @@ export class ResolvedReflectiveFactory {
|
||||
*/
|
||||
export function resolveReflectiveFactory(provider: Provider): ResolvedReflectiveFactory {
|
||||
var factoryFn: Function;
|
||||
var resolvedDeps: any /** TODO #9100 */;
|
||||
var resolvedDeps: ReflectiveDependency[];
|
||||
if (isPresent(provider.useClass)) {
|
||||
var useClass = resolveForwardRef(provider.useClass);
|
||||
factoryFn = reflector.factory(useClass);
|
||||
resolvedDeps = _dependenciesFor(useClass);
|
||||
} else if (isPresent(provider.useExisting)) {
|
||||
factoryFn = (aliasInstance: any /** TODO #9100 */) => aliasInstance;
|
||||
factoryFn = (aliasInstance: any) => aliasInstance;
|
||||
resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
||||
} else if (isPresent(provider.useFactory)) {
|
||||
factoryFn = provider.useFactory;
|
||||
@ -169,7 +169,7 @@ export function mergeResolvedReflectiveProviders(
|
||||
normalizedProvidersMap.set(provider.key.id, provider);
|
||||
}
|
||||
} else {
|
||||
var resolvedProvider: any /** TODO #9100 */;
|
||||
var resolvedProvider: ResolvedReflectiveProvider;
|
||||
if (provider.multiProvider) {
|
||||
resolvedProvider = new ResolvedReflectiveProvider_(
|
||||
provider.key, ListWrapper.clone(provider.resolvedFactories), provider.multiProvider);
|
||||
|
Reference in New Issue
Block a user