refactor(TypeScript): Add noImplicitAny
We automatically insert explicit 'any's where needed. These need to be addressed as in #9100. Fixes #4924
This commit is contained in:
@ -43,7 +43,7 @@ import {stringify} from '../facade/lang';
|
||||
* @stable
|
||||
*/
|
||||
export class InjectMetadata {
|
||||
constructor(public token) {}
|
||||
constructor(public token: any /** TODO #9100 */) {}
|
||||
toString(): string { return `@Inject(${stringify(this.token)})`; }
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ export class OptionalMetadata {
|
||||
* @stable
|
||||
*/
|
||||
export class DependencyMetadata {
|
||||
get token() { return null; }
|
||||
get token(): any /** TODO #9100 */ { return null; }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ export class Provider {
|
||||
/**
|
||||
* Token used when retrieving this provider. Usually, it is a type {@link Type}.
|
||||
*/
|
||||
token;
|
||||
token: any /** TODO #9100 */;
|
||||
|
||||
/**
|
||||
* Binds a DI token to an implementation class.
|
||||
@ -68,7 +68,7 @@ export class Provider {
|
||||
* expect(injector.get("message")).toEqual('Hello');
|
||||
* ```
|
||||
*/
|
||||
useValue;
|
||||
useValue: any /** TODO #9100 */;
|
||||
|
||||
/**
|
||||
* Binds a DI token to an existing token.
|
||||
@ -102,7 +102,7 @@ export class Provider {
|
||||
* expect(injectorClass.get(Vehicle) instanceof Car).toBe(true);
|
||||
* ```
|
||||
*/
|
||||
useExisting;
|
||||
useExisting: any /** TODO #9100 */;
|
||||
|
||||
/**
|
||||
* Binds a DI token to a function which computes the value.
|
||||
@ -148,7 +148,7 @@ export class Provider {
|
||||
/** @internal */
|
||||
_multi: boolean;
|
||||
|
||||
constructor(token, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
constructor(token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
@ -205,7 +205,7 @@ export class Provider {
|
||||
* @ts2dart_const
|
||||
*/
|
||||
export class Binding extends Provider {
|
||||
constructor(token, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||
constructor(token: any /** TODO #9100 */, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||
toClass?: Type,
|
||||
toValue?: any,
|
||||
toAlias?: any,
|
||||
@ -254,7 +254,7 @@ export class Binding extends Provider {
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
export function bind(token): ProviderBuilder {
|
||||
export function bind(token: any /** TODO #9100 */): ProviderBuilder {
|
||||
return new ProviderBuilder(token);
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ export function bind(token): ProviderBuilder {
|
||||
* @deprecated
|
||||
*/
|
||||
export class ProviderBuilder {
|
||||
constructor(public token) {}
|
||||
constructor(public token: any /** TODO #9100 */) {}
|
||||
|
||||
/**
|
||||
* Binds a DI token to a class.
|
||||
@ -388,7 +388,7 @@ export class ProviderBuilder {
|
||||
* <!-- TODO: improve the docs -->
|
||||
* @deprecated
|
||||
*/
|
||||
export function provide(token, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
export function provide(token: any /** TODO #9100 */, {useClass, useValue, useExisting, useFactory, deps, multi}: {
|
||||
useClass?: Type,
|
||||
useValue?: any,
|
||||
useExisting?: any,
|
||||
|
@ -5,7 +5,7 @@ import {ReflectiveKey} from './reflective_key';
|
||||
import {ReflectiveInjector} from './reflective_injector';
|
||||
|
||||
function findFirstClosedCycle(keys: any[]): any[] {
|
||||
var res = [];
|
||||
var res: any[] /** TODO #9100 */ = [];
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
if (ListWrapper.contains(res, keys[i])) {
|
||||
res.push(keys[i]);
|
||||
@ -146,7 +146,7 @@ export class InstantiationError extends WrappedException {
|
||||
/** @internal */
|
||||
injectors: ReflectiveInjector[];
|
||||
|
||||
constructor(injector: ReflectiveInjector, originalException, originalStack, key: ReflectiveKey) {
|
||||
constructor(injector: ReflectiveInjector, originalException: any /** TODO #9100 */, originalStack: any /** TODO #9100 */, key: ReflectiveKey) {
|
||||
super("DI Exception", originalException, originalStack, null);
|
||||
this.keys = [key];
|
||||
this.injectors = [injector];
|
||||
@ -179,7 +179,7 @@ export class InstantiationError extends WrappedException {
|
||||
* @stable
|
||||
*/
|
||||
export class InvalidProviderError extends BaseException {
|
||||
constructor(provider) {
|
||||
constructor(provider: any /** TODO #9100 */) {
|
||||
super(`Invalid provider - only instances of Provider and Type are allowed, got: ${provider}`);
|
||||
}
|
||||
}
|
||||
@ -214,12 +214,12 @@ export class InvalidProviderError extends BaseException {
|
||||
* @stable
|
||||
*/
|
||||
export class NoAnnotationError extends BaseException {
|
||||
constructor(typeOrFunc, params: any[][]) {
|
||||
constructor(typeOrFunc: any /** TODO #9100 */, params: any[][]) {
|
||||
super(NoAnnotationError._genMessage(typeOrFunc, params));
|
||||
}
|
||||
|
||||
private static _genMessage(typeOrFunc, params: any[][]) {
|
||||
var signature = [];
|
||||
private static _genMessage(typeOrFunc: any /** TODO #9100 */, params: any[][]) {
|
||||
var signature: any[] /** TODO #9100 */ = [];
|
||||
for (var i = 0, ii = params.length; i < ii; i++) {
|
||||
var parameter = params[i];
|
||||
if (isBlank(parameter) || parameter.length == 0) {
|
||||
@ -250,7 +250,7 @@ export class NoAnnotationError extends BaseException {
|
||||
* @stable
|
||||
*/
|
||||
export class OutOfBoundsError extends BaseException {
|
||||
constructor(index) { super(`Index ${index} is out-of-bounds.`); }
|
||||
constructor(index: any /** TODO #9100 */) { super(`Index ${index} is out-of-bounds.`); }
|
||||
}
|
||||
|
||||
// TODO: add a working example after alpha38 is released
|
||||
@ -267,7 +267,7 @@ export class OutOfBoundsError extends BaseException {
|
||||
* ```
|
||||
*/
|
||||
export class MixingMultiProvidersWithRegularProvidersError extends BaseException {
|
||||
constructor(provider1, provider2) {
|
||||
constructor(provider1: any /** TODO #9100 */, provider2: any /** TODO #9100 */) {
|
||||
super("Cannot mix multi providers and regular providers, got: " + provider1.toString() + " " +
|
||||
provider2.toString());
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
throw e;
|
||||
}
|
||||
|
||||
var obj;
|
||||
var obj: any /** TODO #9100 */;
|
||||
try {
|
||||
switch (length) {
|
||||
case 0:
|
||||
@ -881,7 +881,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
var INJECTOR_KEY = ReflectiveKey.get(Injector);
|
||||
|
||||
function _mapProviders(injector: ReflectiveInjector_, fn: Function): any[] {
|
||||
var res = [];
|
||||
var res: any[] /** TODO #9100 */ = [];
|
||||
for (var i = 0; i < injector._proto.numberOfProviders; ++i) {
|
||||
res.push(fn(injector._proto.getProviderAtIndex(i)));
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export class ReflectiveDependency {
|
||||
}
|
||||
}
|
||||
|
||||
const _EMPTY_LIST = /*@ts2dart_const*/[];
|
||||
const _EMPTY_LIST: any[] /** TODO #9100 */ = /*@ts2dart_const*/[];
|
||||
|
||||
/**
|
||||
* An internal resolved representation of a {@link Provider} used by the {@link Injector}.
|
||||
@ -109,13 +109,13 @@ export class ResolvedReflectiveFactory {
|
||||
*/
|
||||
export function resolveReflectiveFactory(provider: Provider): ResolvedReflectiveFactory {
|
||||
var factoryFn: Function;
|
||||
var resolvedDeps;
|
||||
var resolvedDeps: any /** TODO #9100 */;
|
||||
if (isPresent(provider.useClass)) {
|
||||
var useClass = resolveForwardRef(provider.useClass);
|
||||
factoryFn = reflector.factory(useClass);
|
||||
resolvedDeps = _dependenciesFor(useClass);
|
||||
} else if (isPresent(provider.useExisting)) {
|
||||
factoryFn = (aliasInstance) => aliasInstance;
|
||||
factoryFn = (aliasInstance: any /** TODO #9100 */) => aliasInstance;
|
||||
resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
||||
} else if (isPresent(provider.useFactory)) {
|
||||
factoryFn = provider.useFactory;
|
||||
@ -173,7 +173,7 @@ export function mergeResolvedReflectiveProviders(
|
||||
normalizedProvidersMap.set(provider.key.id, provider);
|
||||
}
|
||||
} else {
|
||||
var resolvedProvider;
|
||||
var resolvedProvider: any /** TODO #9100 */;
|
||||
if (provider.multiProvider) {
|
||||
resolvedProvider = new ResolvedReflectiveProvider_(
|
||||
provider.key, ListWrapper.clone(provider.resolvedFactories), provider.multiProvider);
|
||||
@ -232,10 +232,10 @@ function _dependenciesFor(typeOrFunc: any): ReflectiveDependency[] {
|
||||
return params.map((p: any[]) => _extractToken(typeOrFunc, p, params));
|
||||
}
|
||||
|
||||
function _extractToken(typeOrFunc, metadata /*any[] | any*/,
|
||||
function _extractToken(typeOrFunc: any /** TODO #9100 */, metadata: any /** TODO #9100 */ /*any[] | any*/,
|
||||
params: any[][]): ReflectiveDependency {
|
||||
var depProps = [];
|
||||
var token = null;
|
||||
var depProps: any[] /** TODO #9100 */ = [];
|
||||
var token: any /** TODO #9100 */ = null;
|
||||
var optional = false;
|
||||
|
||||
if (!isArray(metadata)) {
|
||||
@ -246,8 +246,8 @@ function _extractToken(typeOrFunc, metadata /*any[] | any*/,
|
||||
}
|
||||
}
|
||||
|
||||
var lowerBoundVisibility = null;
|
||||
var upperBoundVisibility = null;
|
||||
var lowerBoundVisibility: any /** TODO #9100 */ = null;
|
||||
var upperBoundVisibility: any /** TODO #9100 */ = null;
|
||||
|
||||
for (var i = 0; i < metadata.length; ++i) {
|
||||
var paramMetadata = metadata[i];
|
||||
@ -287,8 +287,8 @@ function _extractToken(typeOrFunc, metadata /*any[] | any*/,
|
||||
}
|
||||
}
|
||||
|
||||
function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility,
|
||||
depProps): ReflectiveDependency {
|
||||
function _createDependency(token: any /** TODO #9100 */, optional: any /** TODO #9100 */, lowerBoundVisibility: any /** TODO #9100 */, upperBoundVisibility: any /** TODO #9100 */,
|
||||
depProps: any /** TODO #9100 */): ReflectiveDependency {
|
||||
return new ReflectiveDependency(ReflectiveKey.get(token), optional, lowerBoundVisibility,
|
||||
upperBoundVisibility, depProps);
|
||||
}
|
||||
|
Reference in New Issue
Block a user