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:
ScottSWu
2016-06-08 15:45:15 -07:00
parent 87d824e1b4
commit 86fbd50c3d
305 changed files with 2338 additions and 2337 deletions

View File

@ -6,7 +6,7 @@ import {AnimationStyles} from '../../src/animation/animation_styles';
import {MockAnimationPlayer} from '../../testing/animation/mock_animation_player';
export class MockAnimationDriver extends AnimationDriver {
log = [];
log: any[] /** TODO #9100 */ = [];
animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number,
easing: string): AnimationPlayer {
var player = new MockAnimationPlayer();
@ -30,6 +30,6 @@ function _serializeKeyframes(keyframes: AnimationKeyframe[]): any[] {
function _serializeStyles(styles: AnimationStyles): {[key: string]: any} {
var flatStyles = {};
styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val, prop) => { flatStyles[prop] = val; }));
styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val: any /** TODO #9100 */, prop: any /** TODO #9100 */) => { (flatStyles as any /** TODO #9100 */)[prop] = val; }));
return flatStyles;
}

View File

@ -2,12 +2,12 @@ import {isPresent} from '../../src/facade/lang';
import {AnimationPlayer} from '../../src/animation/animation_player';
export class MockAnimationPlayer implements AnimationPlayer {
private _subscriptions = [];
private _subscriptions: any[] /** TODO #9100 */ = [];
private _finished = false;
private _destroyed = false;
public parentPlayer: AnimationPlayer = null;
public log = [];
public log: any[] /** TODO #9100 */ = [];
private _onfinish(): void {
if (!this._finished) {
@ -42,6 +42,6 @@ export class MockAnimationPlayer implements AnimationPlayer {
}
}
setPosition(p): void {}
setPosition(p: any /** TODO #9100 */): void {}
getPosition(): number { return 0; }
}

View File

@ -15,7 +15,7 @@
*/
export function async(fn: Function): Function {
return () => new Promise<void>((finishCallback, failCallback) => {
var AsyncTestZoneSpec = Zone['AsyncTestZoneSpec'];
var AsyncTestZoneSpec = (Zone as any /** TODO #9100 */)['AsyncTestZoneSpec'];
var testZoneSpec = new AsyncTestZoneSpec(finishCallback, failCallback, 'test');
var testZone = Zone.current.fork(testZoneSpec);
return testZone.run(fn);

View File

@ -1,7 +1,7 @@
import {BaseException} from '../index';
import {getTestInjector} from './test_injector';
let _FakeAsyncTestZoneSpecType = Zone['FakeAsyncTestZoneSpec'];
let _FakeAsyncTestZoneSpecType = (Zone as any /** TODO #9100 */)['FakeAsyncTestZoneSpec'];
/**
* Wraps a function to be executed in the fakeAsync zone:
@ -27,7 +27,7 @@ export function fakeAsync(fn: Function): Function {
let fakeAsyncTestZoneSpec = new _FakeAsyncTestZoneSpecType();
let fakeAsyncZone = Zone.current.fork(fakeAsyncTestZoneSpec);
return function(...args) {
return function(...args: any[] /** TODO #9100 */) {
let res = fakeAsyncZone.run(() => {
let res = fn(...args);
flushMicrotasks();

View File

@ -1,4 +1,4 @@
export function getTypeOf(instance) {
export function getTypeOf(instance: any /** TODO #9100 */) {
return instance.constructor;
}

View File

@ -6,9 +6,9 @@ export class Log {
constructor() { this.logItems = []; }
add(value): void { this.logItems.push(value); }
add(value: any /** TODO #9100 */): void { this.logItems.push(value); }
fn(value) {
fn(value: any /** TODO #9100 */) {
return (a1: any = null, a2: any = null, a3: any = null, a4: any = null, a5: any = null) => {
this.logItems.push(value);
};

View File

@ -5,5 +5,5 @@ var _RE_SPECIAL_CHARS =
var _ESCAPE_RE = RegExpWrapper.create(`[\\${_RE_SPECIAL_CHARS.join('\\')}]`);
export function containsRegexp(input: string): RegExp {
return RegExpWrapper.create(
StringWrapper.replaceAllMapped(input, _ESCAPE_RE, (match) => `\\${match[0]}`));
StringWrapper.replaceAllMapped(input, _ESCAPE_RE, (match: any /** TODO #9100 */) => `\\${match[0]}`));
}

View File

@ -8,7 +8,7 @@ import {isPromise} from '../src/facade/lang';
export {inject, async, injectAsync} from './test_injector';
declare var global;
declare var global: any /** TODO #9100 */;
var _global = <any>(typeof window === 'undefined' ? global : window);

View File

@ -11,7 +11,7 @@ export {AsyncTestCompleter} from './async_test_completer';
export {MockAnimationPlayer} from './animation/mock_animation_player';
export {MockAnimationDriver} from './animation/mock_animation_driver';
export var proxy: ClassDecorator = (t) => t;
export var proxy: ClassDecorator = (t: any /** TODO #9100 */) => t;
var _global = <any>(typeof window === 'undefined' ? global : window);
@ -25,7 +25,7 @@ var jsmIt = _global.it;
var jsmIIt = _global.fit;
var jsmXIt = _global.xit;
var runnerStack = [];
var runnerStack: any[] /** TODO #9100 */ = [];
var inIt = false;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 3000;
var globalTimeOut = jasmine.DEFAULT_TIMEOUT_INTERVAL;
@ -53,7 +53,7 @@ class BeforeEachRunner {
// Reset the test providers before each test
jsmBeforeEach(() => { testInjector.reset(); });
function _describe(jsmFn, ...args) {
function _describe(jsmFn: any /** TODO #9100 */, ...args: any[] /** TODO #9100 */) {
var parentRunner = runnerStack.length === 0 ? null : runnerStack[runnerStack.length - 1];
var runner = new BeforeEachRunner(parentRunner);
runnerStack.push(runner);
@ -62,15 +62,15 @@ function _describe(jsmFn, ...args) {
return suite;
}
export function describe(...args): void {
export function describe(...args: any[] /** TODO #9100 */): void {
return _describe(jsmDescribe, ...args);
}
export function ddescribe(...args): void {
export function ddescribe(...args: any[] /** TODO #9100 */): void {
return _describe(jsmDDescribe, ...args);
}
export function xdescribe(...args): void {
export function xdescribe(...args: any[] /** TODO #9100 */): void {
return _describe(jsmXDescribe, ...args);
}
@ -96,7 +96,7 @@ export function beforeEach(fn: Function): void {
* {provide: SomeToken, useValue: myValue},
* ]);
*/
export function beforeEachProviders(fn): void {
export function beforeEachProviders(fn: any /** TODO #9100 */): void {
jsmBeforeEach(() => {
var providers = fn();
if (!providers) return;
@ -107,7 +107,7 @@ export function beforeEachProviders(fn): void {
/**
* @deprecated
*/
export function beforeEachBindings(fn): void {
export function beforeEachBindings(fn: any /** TODO #9100 */): void {
beforeEachProviders(fn);
}
@ -120,7 +120,7 @@ function _it(jsmFn: Function, name: string, testFn: Function, testTimeOut: numbe
var runner = runnerStack[runnerStack.length - 1];
var timeOut = Math.max(globalTimeOut, testTimeOut);
jsmFn(name, (done) => {
jsmFn(name, (done: any /** TODO #9100 */) => {
var completerProvider = {
provide: AsyncTestCompleter,
useFactory: () => {
@ -150,15 +150,15 @@ function _it(jsmFn: Function, name: string, testFn: Function, testTimeOut: numbe
}, timeOut);
}
export function it(name, fn, timeOut = null): void {
export function it(name: any /** TODO #9100 */, fn: any /** TODO #9100 */, timeOut: any /** TODO #9100 */ = null): void {
return _it(jsmIt, name, fn, timeOut);
}
export function xit(name, fn, timeOut = null): void {
export function xit(name: any /** TODO #9100 */, fn: any /** TODO #9100 */, timeOut: any /** TODO #9100 */ = null): void {
return _it(jsmXIt, name, fn, timeOut);
}
export function iit(name, fn, timeOut = null): void {
export function iit(name: any /** TODO #9100 */, fn: any /** TODO #9100 */, timeOut: any /** TODO #9100 */ = null): void {
return _it(jsmIIt, name, fn, timeOut);
}
@ -170,14 +170,14 @@ export interface GuinessCompatibleSpy extends jasmine.Spy {
* function. */
andCallFake(fn: Function): GuinessCompatibleSpy;
/** removes all recorded calls */
reset();
reset(): any /** TODO #9100 */;
}
export class SpyObject {
constructor(type = null) {
constructor(type: any /** TODO #9100 */ = null) {
if (type) {
for (var prop in type.prototype) {
var m = null;
var m: any /** TODO #9100 */ = null;
try {
m = type.prototype[prop];
} catch (e) {
@ -193,18 +193,18 @@ export class SpyObject {
}
}
// Noop so that SpyObject has the same interface as in Dart
noSuchMethod(args) {}
noSuchMethod(args: any /** TODO #9100 */) {}
spy(name) {
if (!this[name]) {
this[name] = this._createGuinnessCompatibleSpy(name);
spy(name: any /** TODO #9100 */) {
if (!(this as any /** TODO #9100 */)[name]) {
(this as any /** TODO #9100 */)[name] = this._createGuinnessCompatibleSpy(name);
}
return this[name];
return (this as any /** TODO #9100 */)[name];
}
prop(name, value) { this[name] = value; }
prop(name: any /** TODO #9100 */, value: any /** TODO #9100 */) { (this as any /** TODO #9100 */)[name] = value; }
static stub(object = null, config = null, overrides = null) {
static stub(object: any /** TODO #9100 */ = null, config: any /** TODO #9100 */ = null, overrides: any /** TODO #9100 */ = null) {
if (!(object instanceof SpyObject)) {
overrides = config;
config = object;
@ -212,12 +212,12 @@ export class SpyObject {
}
var m = StringMapWrapper.merge(config, overrides);
StringMapWrapper.forEach(m, (value, key) => { object.spy(key).andReturn(value); });
StringMapWrapper.forEach(m, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => { object.spy(key).andReturn(value); });
return object;
}
/** @internal */
_createGuinnessCompatibleSpy(name): GuinessCompatibleSpy {
_createGuinnessCompatibleSpy(name: any /** TODO #9100 */): GuinessCompatibleSpy {
var newSpy: GuinessCompatibleSpy = <any>jasmine.createSpy(name);
newSpy.andCallFake = <any>newSpy.and.callFake;
newSpy.andReturn = <any>newSpy.and.returnValue;