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

@ -1,6 +1,6 @@
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';
function waitForElement(selector) {
function waitForElement(selector: any /** TODO #9100 */) {
var EC = (<any>protractor).ExpectedConditions;
// Waits for the element with id 'abc' to be present on the dom.
browser.wait(EC.presenceOf($(selector)), 20000);

View File

@ -1,6 +1,6 @@
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';
function waitForElement(selector) {
function waitForElement(selector: any /** TODO #9100 */) {
var EC = (<any>protractor).ExpectedConditions;
// Waits for the element with id 'abc' to be present on the dom.
browser.wait(EC.presenceOf($(selector)), 20000);

View File

@ -23,12 +23,12 @@ describe('hello world', function() {
});
function getComponentText(selector, innerSelector) {
function getComponentText(selector: any /** TODO #9100 */, innerSelector: any /** TODO #9100 */) {
return browser.executeScript('return document.querySelector("' + selector + '").querySelector("' +
innerSelector + '").textContent');
}
function clickComponentButton(selector, innerSelector) {
function clickComponentButton(selector: any /** TODO #9100 */, innerSelector: any /** TODO #9100 */) {
return browser.executeScript('return document.querySelector("' + selector + '").querySelector("' +
innerSelector + '").click()');
}

View File

@ -14,7 +14,7 @@ describe('http', function() {
});
});
function getComponentText(selector, innerSelector) {
function getComponentText(selector: any /** TODO #9100 */, innerSelector: any /** TODO #9100 */) {
return browser.executeScript('return document.querySelector("' + selector + '").querySelector("' +
innerSelector + '").textContent.trim()');
}

View File

@ -14,7 +14,7 @@ describe('jsonp', function() {
});
});
function getComponentText(selector, innerSelector) {
function getComponentText(selector: any /** TODO #9100 */, innerSelector: any /** TODO #9100 */) {
return browser.executeScript('return document.querySelector("' + selector + '").querySelector("' +
innerSelector + '").textContent.trim()');
}

View File

@ -1,6 +1,6 @@
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';
function waitForElement(selector) {
function waitForElement(selector: any /** TODO #9100 */) {
var EC = (<any>protractor).ExpectedConditions;
// Waits for the element with id 'abc' to be present on the dom.
browser.wait(EC.presenceOf($(selector)), 20000);
@ -24,7 +24,7 @@ describe('relative assets relative-app', () => {
waitForElement('my-cmp .inner-container');
var elem = element(by.css('my-cmp .inner-container'));
var width = browser.executeScript(function(e) {
var width = browser.executeScript(function(e: any /** TODO #9100 */) {
return parseInt(window.getComputedStyle(e).width);
}, elem.getWebElement());

View File

@ -1,6 +1,6 @@
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';
function waitForElement(selector) {
function waitForElement(selector: any /** TODO #9100 */) {
var EC = (<any>protractor).ExpectedConditions;
// Waits for the element with id 'abc' to be present on the dom.
browser.wait(EC.presenceOf($(selector)), 20000);

View File

@ -15,8 +15,8 @@ describe('sourcemaps', function() {
// so that the browser logs can be read out!
browser.executeScript('1+1');
browser.manage().logs().get('browser').then(function(logs) {
var errorLine = null;
var errorColumn = null;
var errorLine: any /** TODO #9100 */ = null;
var errorColumn: any /** TODO #9100 */ = null;
logs.forEach(function(log) {
var match = /\.createError\s+\(.+:(\d+):(\d+)/m.exec(log.message);
if (match) {

View File

@ -64,7 +64,7 @@ describe("WebWorker Router", () => {
}, 5000);
}
function waitForUrl(regex): void {
function waitForUrl(regex: any /** TODO #9100 */): void {
browser.wait(() => {
let deferred = protractor.promise.defer();
browser.getCurrentUrl().then(

View File

@ -53,8 +53,8 @@ class InboxRecord {
this.subject = record['subject'];
this.content = record['content'];
this.email = record['email'];
this.firstName = record['first-name'];
this.lastName = record['last-name'];
this.firstName = (record as any /** TODO #9100 */)['first-name'];
this.lastName = (record as any /** TODO #9100 */)['last-name'];
this.date = record['date'];
this.draft = record['draft'] == true;
}
@ -79,7 +79,7 @@ class DbService {
data.filter(record => !isPresent(record['draft'])));
}
email(id): Promise<any> {
email(id: any /** TODO #9100 */): Promise<any> {
return PromiseWrapper.then(this.getData(), (data: any[]) => {
for (var i = 0; i < data.length; i++) {
var entry = data[i];

View File

@ -60,8 +60,8 @@ import {
]
})
export class AnimateApp {
public items = [];
public _state;
public items: any[] /** TODO #9100 */ = [];
public _state: any /** TODO #9100 */;
public bgStatus = 'focus';

View File

@ -33,9 +33,9 @@ class AsyncApplication {
val2: number = 0;
val3: number = 0;
val4: number = 0;
timeoutId = null;
multiTimeoutId = null;
intervalId = null;
timeoutId: any /** TODO #9100 */ = null;
multiTimeoutId: any /** TODO #9100 */ = null;
intervalId: any /** TODO #9100 */ = null;
increment(): void { this.val1++; };
@ -51,7 +51,7 @@ class AsyncApplication {
this.cancelMultiDelayedIncrements();
var self = this;
function helper(_i) {
function helper(_i: any /** TODO #9100 */) {
if (_i <= 0) {
self.multiTimeoutId = null;
return;

View File

@ -1,7 +1,7 @@
declare var System: any;
(function(global) {
(function(global: any /** TODO #9100 */) {
writeScriptTag('/all/playground/vendor/es6-shim.js');
writeScriptTag('/all/playground/vendor/zone.js');
@ -59,11 +59,11 @@ declare var System: any;
// BOOTSTRAP the app!
System.import('index').then(function(m) { m.main(); }, console.error.bind(console));
System.import('index').then(function(m: any /** TODO #9100 */) { m.main(); }, console.error.bind(console));
}
function writeScriptTag(scriptUrl, onload?) {
function writeScriptTag(scriptUrl: any /** TODO #9100 */, onload?: any /** TODO #9100 */) {
document.write(`<script src="${scriptUrl}" onload="${onload}"></script>`);
}
}(window));

View File

@ -7,11 +7,11 @@ class GesturesCmp {
pinchScale: number = 1;
rotateAngle: number = 0;
onSwipe(event): void { this.swipeDirection = event.deltaX > 0 ? 'right' : 'left'; }
onSwipe(event: any /** TODO #9100 */): void { this.swipeDirection = event.deltaX > 0 ? 'right' : 'left'; }
onPinch(event): void { this.pinchScale = event.scale; }
onPinch(event: any /** TODO #9100 */): void { this.pinchScale = event.scale; }
onRotate(event): void { this.rotateAngle = event.rotation; }
onRotate(event: any /** TODO #9100 */): void { this.rotateAngle = event.rotation; }
}
export function main() {

View File

@ -18,12 +18,12 @@ class KeyEventsApp {
lastKey: string = '(none)';
shiftEnter: boolean = false;
onKeyDown(event): void {
onKeyDown(event: any /** TODO #9100 */): void {
this.lastKey = KeyEventsPlugin.getEventFullKey(event);
event.preventDefault();
}
onShiftEnter(event): void {
onShiftEnter(event: any /** TODO #9100 */): void {
this.shiftEnter = true;
event.preventDefault();
}

View File

@ -48,7 +48,7 @@ function creditCardValidator(c: AbstractControl): {[key: string]: boolean} {
directives: [NgIf]
})
class ShowError {
formDir;
formDir: any /** TODO #9100 */;
controlPath: string;
errorTypes: string[];
@ -69,7 +69,7 @@ class ShowError {
_errorMessage(code: string): string {
var config = {'required': 'is required', 'invalidCreditCard': 'is invalid credit card number'};
return config[code];
return (config as any /** TODO #9100 */)[code];
}
}
@ -135,7 +135,7 @@ class ShowError {
directives: [FORM_DIRECTIVES, NgFor, ShowError]
})
class ModelDrivenForms {
form;
form: any /** TODO #9100 */;
countries = ['US', 'Canada'];
constructor(fb: FormBuilder) {

View File

@ -49,8 +49,8 @@ class InboxRecord {
this.subject = record['subject'];
this.content = record['content'];
this.email = record['email'];
this.firstName = record['first-name'];
this.lastName = record['last-name'];
this.firstName = (record as any /** TODO #9100 */)['first-name'];
this.lastName = (record as any /** TODO #9100 */)['last-name'];
this.date = record['date'];
this.draft = record['draft'] == true;
}
@ -75,7 +75,7 @@ class DbService {
data.filter(record => !isPresent(record['draft'])));
}
email(id): Promise<any> {
email(id: any /** TODO #9100 */): Promise<any> {
return PromiseWrapper.then(this.getData(), (data: any[]) => {
for (var i = 0; i < data.length; i++) {
var entry = data[i];

View File

@ -31,7 +31,7 @@ class CheckoutModel {
/**
* Custom validator.
*/
function creditCardValidator(c): {[key: string]: boolean} {
function creditCardValidator(c: any /** TODO #9100 */): {[key: string]: boolean} {
if (isPresent(c.value) && RegExpWrapper.test(/^\d{16}$/g, c.value)) {
return null;
} else {
@ -73,7 +73,7 @@ class CreditCardValidator {
directives: [NgIf]
})
class ShowError {
formDir;
formDir: any /** TODO #9100 */;
controlPath: string;
errorTypes: string[];
@ -94,7 +94,7 @@ class ShowError {
_errorMessage(code: string): string {
var config = {'required': 'is required', 'invalidCreditCard': 'is invalid credit card number'};
return config[code];
return (config as any /** TODO #9100 */)[code];
}
}

View File

@ -14,14 +14,14 @@ class TodoApp {
constructor(public todoStore: Store<Todo>, public factory: TodoFactory) {}
enterTodo(inputElement): void {
enterTodo(inputElement: any /** TODO #9100 */): void {
this.addTodo(inputElement.value);
inputElement.value = '';
}
editTodo(todo: Todo): void { this.todoEdit = todo; }
doneEditing($event, todo: Todo): void {
doneEditing($event: any /** TODO #9100 */, todo: Todo): void {
var which = $event.which;
var target = $event.target;
if (which === 13) {
@ -39,7 +39,7 @@ class TodoApp {
deleteMe(todo: Todo): void { this.todoStore.remove(todo); }
toggleAll($event): void {
toggleAll($event: any /** TODO #9100 */): void {
var isComplete = $event.target.checked;
this.todoStore.list.forEach((todo: Todo) => { todo.completed = isComplete; });
}

View File

@ -22,7 +22,7 @@ var adapter: UpgradeAdapter = new UpgradeAdapter();
var ng1module = angular.module('myExample', []);
ng1module.controller('Index', function($scope) { $scope.name = 'World'; });
ng1module.controller('Index', function($scope: any /** TODO #9100 */) { $scope.name = 'World'; });
ng1module.directive('user', function() {
return {

View File

@ -7,12 +7,12 @@ import {FileReader, Uint8ArrayWrapper} from './file_api';
@Component({selector: 'image-demo', viewProviders: [BitmapService], templateUrl: 'image_demo.html'})
export class ImageDemo {
images = [];
images: any[] /** TODO #9100 */ = [];
fileInput: String;
constructor(private _bitmapService: BitmapService) {}
uploadFiles(files) {
uploadFiles(files: any /** TODO #9100 */) {
for (var i = 0; i < files.length; i++) {
var reader = new FileReader();
reader.addEventListener("load", this.handleReaderLoad(reader));

View File

@ -1,6 +1,6 @@
/// <reference path="../bitmap.d.ts" /> /// <reference path="../b64.d.ts" />
import {Injectable} from '@angular/core';
declare var base64js;
declare var base64js: any /** TODO #9100 */;
// Temporary fix for Typescript issue #4220 (https://github.com/Microsoft/TypeScript/issues/4220)
// var _ImageData: (width: number, height: number) => void = <any>postMessage;
@ -151,7 +151,7 @@ export class BitmapService {
// Based on example from
// http://www.worldwidewhat.net/2012/07/how-to-draw-bitmaps-using-javascript/
private _getLittleEndianHex(value: number): string {
var result = [];
var result: any[] /** TODO #9100 */ = [];
for (var bytes = 4; bytes > 0; bytes--) {
result.push(String.fromCharCode(value & 255));

View File

@ -18,7 +18,7 @@ export class InputCmp {
inputVal = "";
textareaVal = "";
inputChanged(e) { this.inputVal = e.target.value; }
inputChanged(e: any /** TODO #9100 */) { this.inputVal = e.target.value; }
textAreaChanged(e) { this.textareaVal = e.target.value; }
textAreaChanged(e: any /** TODO #9100 */) { this.textareaVal = e.target.value; }
}

View File

@ -52,5 +52,5 @@ export class HelloCmp {
changeGreeting(): void { this.greeting = 'howdy'; }
onKeyDown(event): void { this.lastKey = StringWrapper.fromCharCode(event.keyCode); }
onKeyDown(event: any /** TODO #9100 */): void { this.lastKey = StringWrapper.fromCharCode(event.keyCode); }
}

View File

@ -22,7 +22,7 @@ export class TodoApp {
this.inputValue = "";
}
doneEditing($event, todo: Todo): void {
doneEditing($event: any /** TODO #9100 */, todo: Todo): void {
var which = $event.keyCode;
if (which === 13) {
todo.title = todo.editTitle;
@ -56,7 +56,7 @@ export class TodoApp {
deleteMe(todo: Todo): void { this.todoStore.remove(todo); }
toggleAll($event): void {
toggleAll($event: any /** TODO #9100 */): void {
this.isComplete = !this.isComplete;
this.todoStore.list.forEach((todo: Todo) => { todo.completed = this.isComplete; });
}