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:
@ -129,13 +129,13 @@ export class EventEmitter<T> extends Subject<T> {
|
||||
next(value: any) { super.next(value); }
|
||||
|
||||
subscribe(generatorOrNext?: any, error?: any, complete?: any): any {
|
||||
let schedulerFn;
|
||||
let errorFn = (err: any) => null;
|
||||
let completeFn = () => null;
|
||||
let schedulerFn: any /** TODO #9100 */;
|
||||
let errorFn = (err: any): any /** TODO #9100 */ => null;
|
||||
let completeFn = (): any /** TODO #9100 */ => null;
|
||||
|
||||
if (generatorOrNext && typeof generatorOrNext === 'object') {
|
||||
schedulerFn = this.__isAsync ? (value) => { setTimeout(() => generatorOrNext.next(value)); } :
|
||||
(value) => { generatorOrNext.next(value); };
|
||||
schedulerFn = this.__isAsync ? (value: any /** TODO #9100 */) => { setTimeout(() => generatorOrNext.next(value)); } :
|
||||
(value: any /** TODO #9100 */) => { generatorOrNext.next(value); };
|
||||
|
||||
if (generatorOrNext.error) {
|
||||
errorFn = this.__isAsync ? (err) => { setTimeout(() => generatorOrNext.error(err)); } :
|
||||
@ -147,8 +147,8 @@ export class EventEmitter<T> extends Subject<T> {
|
||||
() => { generatorOrNext.complete(); };
|
||||
}
|
||||
} else {
|
||||
schedulerFn = this.__isAsync ? (value) => { setTimeout(() => generatorOrNext(value)); } :
|
||||
(value) => { generatorOrNext(value); };
|
||||
schedulerFn = this.__isAsync ? (value: any /** TODO #9100 */) => { setTimeout(() => generatorOrNext(value)); } :
|
||||
(value: any /** TODO #9100 */) => { generatorOrNext(value); };
|
||||
|
||||
if (error) {
|
||||
errorFn =
|
||||
|
@ -6,7 +6,7 @@ var win = typeof window !== 'undefined' && window || <any>{};
|
||||
export {win as window};
|
||||
export var document = win.document;
|
||||
export var location = win.location;
|
||||
export var gc = win['gc'] ? () => win['gc']() : () => null;
|
||||
export var gc = win['gc'] ? () => win['gc']() : (): any /** TODO #9100 */ => null;
|
||||
export var performance = win['performance'] ? win['performance'] : null;
|
||||
export const Event = win['Event'];
|
||||
export const MouseEvent = win['MouseEvent'];
|
||||
|
@ -34,11 +34,11 @@ var createMapFromMap: {(m: Map<any, any>): Map<any, any>} = (function() {
|
||||
return map;
|
||||
};
|
||||
})();
|
||||
var _clearValues: {(m: Map<any, any>)} = (function() {
|
||||
var _clearValues: {(m: Map<any, any>): void} = (function() {
|
||||
if ((<any>(new Map()).keys()).next) {
|
||||
return function _clearValues(m: Map<any, any>) {
|
||||
var keyIterator = m.keys();
|
||||
var k;
|
||||
var k: any /** TODO #???? */;
|
||||
while (!((k = (<any>keyIterator).next()).done)) {
|
||||
m.set(k.value, null);
|
||||
}
|
||||
@ -154,7 +154,7 @@ export class StringMapWrapper {
|
||||
if (k1.length != k2.length) {
|
||||
return false;
|
||||
}
|
||||
var key;
|
||||
var key: any /** TODO #???? */;
|
||||
for (var i = 0; i < k1.length; i++) {
|
||||
key = k1[i];
|
||||
if (m1[key] !== m2[key]) {
|
||||
@ -249,7 +249,7 @@ export class ListWrapper {
|
||||
if (list.length == 0) {
|
||||
return null;
|
||||
}
|
||||
var solution = null;
|
||||
var solution: any /** TODO #???? */ = null;
|
||||
var maxValue = -Infinity;
|
||||
for (var index = 0; index < list.length; index++) {
|
||||
var candidate = list[index];
|
||||
@ -266,7 +266,7 @@ export class ListWrapper {
|
||||
}
|
||||
|
||||
static flatten<T>(list: Array<T | T[]>): T[] {
|
||||
var target = [];
|
||||
var target: any[] /** TODO #???? */ = [];
|
||||
_flattenArray(list, target);
|
||||
return target;
|
||||
}
|
||||
@ -320,7 +320,7 @@ export function iterateListLike(obj: any, fn: Function) {
|
||||
}
|
||||
} else {
|
||||
var iterator = obj[getSymbolIterator()]();
|
||||
var item;
|
||||
var item: any /** TODO #???? */;
|
||||
while (!((item = iterator.next()).done)) {
|
||||
fn(item.value);
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ export class BaseException extends Error {
|
||||
export class WrappedException extends BaseWrappedException {
|
||||
private _wrapperStack: any;
|
||||
|
||||
constructor(private _wrapperMessage: string, private _originalException, private _originalStack?,
|
||||
private _context?) {
|
||||
constructor(private _wrapperMessage: string, private _originalException: any /** TODO #9100 */, private _originalStack?: any /** TODO #9100 */,
|
||||
private _context?: any /** TODO #9100 */) {
|
||||
super(_wrapperMessage);
|
||||
this._wrapperStack = (<any>new Error(_wrapperMessage)).stack;
|
||||
}
|
||||
|
@ -132,12 +132,12 @@ function hour12Modify(options: Intl.DateTimeFormatOptions,
|
||||
|
||||
function digitCondition(prop: string, len: number): Intl.DateTimeFormatOptions {
|
||||
var result = {};
|
||||
result[prop] = len == 2 ? '2-digit' : 'numeric';
|
||||
(result as any /** TODO #9100 */)[prop] = len == 2 ? '2-digit' : 'numeric';
|
||||
return result;
|
||||
}
|
||||
function nameCondition(prop: string, len: number): Intl.DateTimeFormatOptions {
|
||||
var result = {};
|
||||
result[prop] = len < 4 ? 'short' : 'long';
|
||||
(result as any /** TODO #9100 */)[prop] = len < 4 ? 'short' : 'long';
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -161,11 +161,11 @@ var datePartsFormatterCache: Map<string, string[]> = new Map<string, string[]>()
|
||||
|
||||
function dateFormatter(format: string, date: Date, locale: string): string {
|
||||
var text = '';
|
||||
var match;
|
||||
var fn;
|
||||
var match: any /** TODO #9100 */;
|
||||
var fn: any /** TODO #9100 */;
|
||||
var parts: string[] = [];
|
||||
if (PATTERN_ALIASES[format]) {
|
||||
return PATTERN_ALIASES[format](date, locale);
|
||||
if ((PATTERN_ALIASES as any /** TODO #9100 */)[format]) {
|
||||
return (PATTERN_ALIASES as any /** TODO #9100 */)[format](date, locale);
|
||||
}
|
||||
|
||||
|
||||
@ -189,7 +189,7 @@ function dateFormatter(format: string, date: Date, locale: string): string {
|
||||
}
|
||||
|
||||
parts.forEach(part => {
|
||||
fn = DATE_FORMATS[part];
|
||||
fn = (DATE_FORMATS as any /** TODO #9100 */)[part];
|
||||
text += fn ? fn(date, locale) :
|
||||
part === "''" ? "'" : part.replace(/(^'|'$)/g, '').replace(/''/g, "'");
|
||||
});
|
||||
@ -198,7 +198,7 @@ function dateFormatter(format: string, date: Date, locale: string): string {
|
||||
}
|
||||
|
||||
var slice = [].slice;
|
||||
function concat(array1, array2, index): string[] {
|
||||
function concat(array1: any /** TODO #9100 */, array2: any /** TODO #9100 */, index: any /** TODO #9100 */): string[] {
|
||||
return array1.concat(slice.call(array2, index));
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,11 @@ export interface BrowserNodeGlobal {
|
||||
}
|
||||
|
||||
// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492
|
||||
declare var WorkerGlobalScope;
|
||||
declare var WorkerGlobalScope: any /** TODO #9100 */;
|
||||
// CommonJS / Node have global context exposed as "global" variable.
|
||||
// We don't want to include the whole node.d.ts this this compilation unit so we'll just fake
|
||||
// the global "global" var for now.
|
||||
declare var global;
|
||||
declare var global: any /** TODO #9100 */;
|
||||
|
||||
var globalScope: BrowserNodeGlobal;
|
||||
if (typeof window === 'undefined') {
|
||||
@ -64,7 +64,7 @@ export interface Type extends Function {}
|
||||
/**
|
||||
* Runtime representation of a type that is constructable (non-abstract).
|
||||
*/
|
||||
export interface ConcreteType extends Type { new (...args): any; }
|
||||
export interface ConcreteType extends Type { new (...args: any[] /** TODO #9100 */): any; }
|
||||
|
||||
export function getTypeNameForDebugging(type: Type): string {
|
||||
if (type['name']) {
|
||||
@ -157,13 +157,13 @@ export function isArray(obj: any): boolean {
|
||||
return Array.isArray(obj);
|
||||
}
|
||||
|
||||
export function isDate(obj): boolean {
|
||||
export function isDate(obj: any /** TODO #9100 */): boolean {
|
||||
return obj instanceof Date && !isNaN(obj.valueOf());
|
||||
}
|
||||
|
||||
export function noop() {}
|
||||
|
||||
export function stringify(token): string {
|
||||
export function stringify(token: any /** TODO #9100 */): string {
|
||||
if (typeof token === 'string') {
|
||||
return token;
|
||||
}
|
||||
@ -187,15 +187,15 @@ export function stringify(token): string {
|
||||
// serialize / deserialize enum exist only for consistency with dart API
|
||||
// enums in typescript don't need to be serialized
|
||||
|
||||
export function serializeEnum(val): number {
|
||||
export function serializeEnum(val: any /** TODO #9100 */): number {
|
||||
return val;
|
||||
}
|
||||
|
||||
export function deserializeEnum(val, values: Map<number, any>): any {
|
||||
export function deserializeEnum(val: any /** TODO #9100 */, values: Map<number, any>): any {
|
||||
return val;
|
||||
}
|
||||
|
||||
export function resolveEnumToken(enumValue, val): string {
|
||||
export function resolveEnumToken(enumValue: any /** TODO #9100 */, val: any /** TODO #9100 */): string {
|
||||
return enumValue[val];
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ export class StringWrapper {
|
||||
}
|
||||
|
||||
static replaceAllMapped(s: string, from: RegExp, cb: Function): string {
|
||||
return s.replace(from, function(...matches) {
|
||||
return s.replace(from, function(...matches: any[] /** TODO #9100 */) {
|
||||
// Remove offset & string from the result array
|
||||
matches.splice(-2, 2);
|
||||
// The callback receives match, p1, ..., pn
|
||||
@ -267,7 +267,7 @@ export class StringWrapper {
|
||||
}
|
||||
|
||||
export class StringJoiner {
|
||||
constructor(public parts = []) {}
|
||||
constructor(public parts: any[] /** TODO #9100 */ = []) {}
|
||||
|
||||
add(part: string): void { this.parts.push(part); }
|
||||
|
||||
@ -385,7 +385,7 @@ export class FunctionWrapper {
|
||||
}
|
||||
|
||||
// JS has NaN !== NaN
|
||||
export function looseIdentical(a, b): boolean {
|
||||
export function looseIdentical(a: any /** TODO #9100 */, b: any /** TODO #9100 */): boolean {
|
||||
return a === b || typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b);
|
||||
}
|
||||
|
||||
@ -454,8 +454,8 @@ export function setValueOnPath(global: any, path: string, value: any) {
|
||||
}
|
||||
|
||||
// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
|
||||
declare var Symbol;
|
||||
var _symbolIterator = null;
|
||||
declare var Symbol: any /** TODO #9100 */;
|
||||
var _symbolIterator: any /** TODO #9100 */ = null;
|
||||
export function getSymbolIterator(): string | symbol {
|
||||
if (isBlank(_symbolIterator)) {
|
||||
if (isPresent((<any>globalScope).Symbol) && isPresent(Symbol.iterator)) {
|
||||
@ -466,7 +466,7 @@ export function getSymbolIterator(): string | symbol {
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
if (key !== 'entries' && key !== 'size' &&
|
||||
Map.prototype[key] === Map.prototype['entries']) {
|
||||
(Map as any /** TODO #9100 */).prototype[key] === Map.prototype['entries']) {
|
||||
_symbolIterator = key;
|
||||
}
|
||||
}
|
||||
@ -478,8 +478,8 @@ export function getSymbolIterator(): string | symbol {
|
||||
export function evalExpression(sourceUrl: string, expr: string, declarations: string,
|
||||
vars: {[key: string]: any}): any {
|
||||
var fnBody = `${declarations}\nreturn ${expr}\n//# sourceURL=${sourceUrl}`;
|
||||
var fnArgNames = [];
|
||||
var fnArgValues = [];
|
||||
var fnArgNames: any[] /** TODO #9100 */ = [];
|
||||
var fnArgValues: any[] /** TODO #9100 */ = [];
|
||||
for (var argName in vars) {
|
||||
fnArgNames.push(argName);
|
||||
fnArgValues.push(vars[argName]);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {global} from './lang';
|
||||
|
||||
export var Math = global.Math;
|
||||
export var NaN = typeof NaN;
|
||||
export var NaN: any /** TODO #???? */ = typeof NaN;
|
||||
|
@ -15,7 +15,7 @@ export class PromiseCompleter<R> {
|
||||
export class PromiseWrapper {
|
||||
static resolve<T>(obj: T): Promise<T> { return Promise.resolve(obj); }
|
||||
|
||||
static reject(obj: any, _): Promise<any> { return Promise.reject(obj); }
|
||||
static reject(obj: any, _: any /** TODO #9100 */): Promise<any> { return Promise.reject(obj); }
|
||||
|
||||
// Note: We can't rename this method into `catch`, as this is not a valid
|
||||
// method name in Dart.
|
||||
|
Reference in New Issue
Block a user