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

@ -35,7 +35,7 @@ class ComplexItem {
export function main() {
describe('iterable differ', function() {
describe('DefaultIterableDiffer', function() {
var differ;
var differ: any /** TODO #9100 */;
beforeEach(() => { differ = new DefaultIterableDiffer(); });
@ -71,7 +71,7 @@ export function main() {
});
it('should detect additions', () => {
let l = [];
let l: any[] /** TODO #9100 */ = [];
differ.check(l);
expect(differ.toString()).toEqual(iterableChangesAsString({collection: []}));
@ -155,7 +155,7 @@ export function main() {
});
it('should detect changes in list', () => {
let l = [];
let l: any[] /** TODO #9100 */ = [];
differ.check(l);
l.push('a');
@ -339,7 +339,7 @@ export function main() {
});
describe('trackBy function by id', function() {
var differ;
var differ: any /** TODO #9100 */;
var trackByItemId = (index: number, item: any): any => item.id;
@ -434,7 +434,7 @@ export function main() {
});
});
describe('trackBy function by index', function() {
var differ;
var differ: any /** TODO #9100 */;
var trackByIndex = (index: number, item: any): number => index;

View File

@ -19,7 +19,7 @@ import {kvChangesAsString} from '../../change_detection/util';
export function main() {
describe('keyvalue differ', function() {
describe('DefaultKeyValueDiffer', function() {
var differ;
var differ: any /** TODO #9100 */;
var m: Map<any, any>;
beforeEach(() => {
@ -61,7 +61,7 @@ export function main() {
});
it('should expose previous and current value', () => {
var previous, current;
var previous: any /** TODO #9100 */, current: any /** TODO #9100 */;
m.set(1, 10);
differ.check(m);
@ -69,7 +69,7 @@ export function main() {
m.set(1, 20);
differ.check(m);
differ.forEachChangedItem((record) => {
differ.forEachChangedItem((record: any /** TODO #9100 */) => {
previous = record.previousValue;
current = record.currentValue;
});
@ -154,19 +154,19 @@ export function main() {
let m = {};
differ.check(m);
m['a'] = 'A';
(m as any /** TODO #9100 */)['a'] = 'A';
differ.check(m);
expect(differ.toString())
.toEqual(kvChangesAsString({map: ['a[null->A]'], additions: ['a[null->A]']}));
m['b'] = 'B';
(m as any /** TODO #9100 */)['b'] = 'B';
differ.check(m);
expect(differ.toString())
.toEqual(kvChangesAsString(
{map: ['a', 'b[null->B]'], previous: ['a'], additions: ['b[null->B]']}));
m['b'] = 'BB';
m['d'] = 'D';
(m as any /** TODO #9100 */)['b'] = 'BB';
(m as any /** TODO #9100 */)['d'] = 'D';
differ.check(m);
expect(differ.toString())
.toEqual(kvChangesAsString({
@ -177,8 +177,8 @@ export function main() {
}));
m = {};
m['a'] = 'A';
m['d'] = 'D';
(m as any /** TODO #9100 */)['a'] = 'A';
(m as any /** TODO #9100 */)['d'] = 'D';
differ.check(m);
expect(differ.toString())
.toEqual(kvChangesAsString({

View File

@ -14,9 +14,9 @@ import {Injector, provide, ReflectiveInjector} from '@angular/core';
export function main() {
describe('IterableDiffers', function() {
var factory1;
var factory2;
var factory3;
var factory1: any /** TODO #9100 */;
var factory2: any /** TODO #9100 */;
var factory3: any /** TODO #9100 */;
beforeEach(() => {
factory1 = new SpyIterableDifferFactory();

View File

@ -4,5 +4,5 @@ export class TestIterable {
list: number[];
constructor() { this.list = []; }
[getSymbolIterator()]() { return this.list[getSymbolIterator()](); }
[getSymbolIterator()]() { return (this.list as any)[getSymbolIterator()](); }
}

View File

@ -1,9 +1,9 @@
import {isBlank} from '../../src/facade/lang';
export function iterableChangesAsString(
{collection = /*@ts2dart_const*/[], previous = /*@ts2dart_const*/[],
additions = /*@ts2dart_const*/[], moves = /*@ts2dart_const*/[],
removals = /*@ts2dart_const*/[], identityChanges = /*@ts2dart_const*/[]}) {
{collection = /*@ts2dart_const*/[] as any, previous = /*@ts2dart_const*/[] as any,
additions = /*@ts2dart_const*/[] as any, moves = /*@ts2dart_const*/[] as any,
removals = /*@ts2dart_const*/[] as any, identityChanges = /*@ts2dart_const*/[] as any}): string {
return "collection: " + collection.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
"additions: " + additions.join(', ') + "\n" + "moves: " + moves.join(', ') + "\n" +
"removals: " + removals.join(', ') + "\n" + "identityChanges: " +