From b986c54079e1082303027676fa2e596d75dfcd67 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 20 Aug 2015 16:25:34 -0700 Subject: [PATCH] chore: remove int in favor for number Closes #3511 --- modules/angular2/globals.d.ts | 1 - .../src/change_detection/codegen_name_util.ts | 12 +++---- .../differs/default_iterable_differ.ts | 28 ++++++++-------- .../src/change_detection/parser/parser.ts | 14 ++++---- .../src/core/compiler/element_binder.ts | 2 +- .../src/core/compiler/element_injector.ts | 5 +-- modules/angular2/src/core/compiler/view.ts | 6 ++-- modules/angular2/src/facade/async.ts | 10 +++--- modules/angular2/src/facade/intl.ts | 10 +++--- modules/angular2/src/facade/lang.dart | 2 +- modules/angular2/src/facade/lang.ts | 32 +++++++++---------- modules/angular2/src/pipes/limit_to_pipe.ts | 2 +- .../src/web-workers/shared/serializer.ts | 10 +++--- .../test/change_detection/iterable.ts | 2 +- .../change_detection/parser/lexer_spec.ts | 10 +++--- .../angular2/test/facade/collection_spec.ts | 2 +- .../src/components/grid_list/grid_list.ts | 6 ++-- .../src/naive_infinite_scroll/app.ts | 8 ++--- .../src/naive_infinite_scroll/cells.ts | 4 +-- .../src/naive_infinite_scroll/random_data.ts | 16 +++++----- .../benchpress/src/metric/perflog_metric.ts | 4 +-- modules/http/src/enums.ts | 2 +- 22 files changed, 95 insertions(+), 93 deletions(-) diff --git a/modules/angular2/globals.d.ts b/modules/angular2/globals.d.ts index 4e45e219f9..a0f11f9223 100644 --- a/modules/angular2/globals.d.ts +++ b/modules/angular2/globals.d.ts @@ -4,7 +4,6 @@ /// declare var assert: any; -declare type int = number; interface List extends Array {} diff --git a/modules/angular2/src/change_detection/codegen_name_util.ts b/modules/angular2/src/change_detection/codegen_name_util.ts index 4300c17ac9..eb5aaced3a 100644 --- a/modules/angular2/src/change_detection/codegen_name_util.ts +++ b/modules/angular2/src/change_detection/codegen_name_util.ts @@ -83,13 +83,13 @@ export class CodegenNameUtil { return this._addFieldPrefix(_FIRST_PROTO_IN_CURRENT_BINDING); } - getLocalName(idx: int): string { return `l_${this._sanitizedNames[idx]}`; } + getLocalName(idx: number): string { return `l_${this._sanitizedNames[idx]}`; } - getEventLocalName(eb: EventBinding, idx: int): string { + getEventLocalName(eb: EventBinding, idx: number): string { return `l_${MapWrapper.get(this._sanitizedEventNames, eb)[idx]}`; } - getChangeName(idx: int): string { return `c_${this._sanitizedNames[idx]}`; } + getChangeName(idx: number): string { return `c_${this._sanitizedNames[idx]}`; } /** * Generate a statement initializing local variables used when detecting changes. @@ -133,9 +133,9 @@ export class CodegenNameUtil { getPreventDefaultAccesor(): string { return "preventDefault"; } - getFieldCount(): int { return this._sanitizedNames.length; } + getFieldCount(): number { return this._sanitizedNames.length; } - getFieldName(idx: int): string { return this._addFieldPrefix(this._sanitizedNames[idx]); } + getFieldName(idx: number): string { return this._addFieldPrefix(this._sanitizedNames[idx]); } getAllFieldNames(): List { var fieldList = []; @@ -188,7 +188,7 @@ export class CodegenNameUtil { '\n'); } - getPipeName(idx: int): string { + getPipeName(idx: number): string { return this._addFieldPrefix(`${this._sanitizedNames[idx]}_pipe`); } diff --git a/modules/angular2/src/change_detection/differs/default_iterable_differ.ts b/modules/angular2/src/change_detection/differs/default_iterable_differ.ts index 2485328761..f592cd0741 100644 --- a/modules/angular2/src/change_detection/differs/default_iterable_differ.ts +++ b/modules/angular2/src/change_detection/differs/default_iterable_differ.ts @@ -26,7 +26,7 @@ export class DefaultIterableDifferFactory implements IterableDifferFactory { export class DefaultIterableDiffer implements IterableDiffer { private _collection = null; - private _length: int = null; + private _length: number = null; // Keeps track of the used records at any point in time (during & across `_check()` calls) private _linkedRecords: _DuplicateMap = null; // Keeps track of the removed records at any point in time during `_check()` calls. @@ -43,7 +43,7 @@ export class DefaultIterableDiffer implements IterableDiffer { get collection() { return this._collection; } - get length(): int { return this._length; } + get length(): number { return this._length; } forEachItem(fn: Function) { var record: CollectionChangeRecord; @@ -101,7 +101,7 @@ export class DefaultIterableDiffer implements IterableDiffer { var record: CollectionChangeRecord = this._itHead; var mayBeDirty: boolean = false; - var index: int; + var index: number; var item; if (isArray(collection)) { @@ -185,7 +185,7 @@ export class DefaultIterableDiffer implements IterableDiffer { * - `item` is the current item in the collection * - `index` is the position of the item in the collection */ - _mismatch(record: CollectionChangeRecord, item, index: int): CollectionChangeRecord { + _mismatch(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord { // The previous record after which we will append the current one. var previousRecord: CollectionChangeRecord; @@ -241,7 +241,7 @@ export class DefaultIterableDiffer implements IterableDiffer { * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a' * at the end. */ - _verifyReinsertion(record: CollectionChangeRecord, item, index: int): CollectionChangeRecord { + _verifyReinsertion(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord { var reinsertRecord: CollectionChangeRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item); if (reinsertRecord !== null) { @@ -284,7 +284,7 @@ export class DefaultIterableDiffer implements IterableDiffer { } _reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, - index: int): CollectionChangeRecord { + index: number): CollectionChangeRecord { if (this._unlinkedRecords !== null) { this._unlinkedRecords.remove(record); } @@ -308,7 +308,7 @@ export class DefaultIterableDiffer implements IterableDiffer { } _moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, - index: int): CollectionChangeRecord { + index: number): CollectionChangeRecord { this._unlink(record); this._insertAfter(record, prevRecord, index); this._addToMoves(record, index); @@ -316,7 +316,7 @@ export class DefaultIterableDiffer implements IterableDiffer { } _addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, - index: int): CollectionChangeRecord { + index: number): CollectionChangeRecord { this._insertAfter(record, prevRecord, index); if (this._additionsTail === null) { @@ -333,7 +333,7 @@ export class DefaultIterableDiffer implements IterableDiffer { } _insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord, - index: int): CollectionChangeRecord { + index: number): CollectionChangeRecord { // todo(vicb) // assert(record != prevRecord); // assert(record._next === null); @@ -395,7 +395,7 @@ export class DefaultIterableDiffer implements IterableDiffer { return record; } - _addToMoves(record: CollectionChangeRecord, toIndex: int): CollectionChangeRecord { + _addToMoves(record: CollectionChangeRecord, toIndex: number): CollectionChangeRecord { // todo(vicb) // assert(record._nextMoved === null); @@ -473,8 +473,8 @@ export class DefaultIterableDiffer implements IterableDiffer { } export class CollectionChangeRecord { - currentIndex: int = null; - previousIndex: int = null; + currentIndex: number = null; + previousIndex: number = null; _nextPrevious: CollectionChangeRecord = null; _prev: CollectionChangeRecord = null; @@ -524,7 +524,7 @@ class _DuplicateItemRecordList { // Returns a CollectionChangeRecord having CollectionChangeRecord.item == item and // CollectionChangeRecord.currentIndex >= afterIndex - get(item: any, afterIndex: int): CollectionChangeRecord { + get(item: any, afterIndex: number): CollectionChangeRecord { var record: CollectionChangeRecord; for (record = this._head; record !== null; record = record._nextDup) { if ((afterIndex === null || afterIndex < record.currentIndex) && @@ -588,7 +588,7 @@ class _DuplicateMap { * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we * have any more `a`s needs to return the last `a` not the first or second. */ - get(value: any, afterIndex: int = null): CollectionChangeRecord { + get(value: any, afterIndex: number = null): CollectionChangeRecord { var key = getMapKey(value); var recordList = this.map.get(key); diff --git a/modules/angular2/src/change_detection/parser/parser.ts b/modules/angular2/src/change_detection/parser/parser.ts index 296e4f35f0..7b1519df3b 100644 --- a/modules/angular2/src/change_detection/parser/parser.ts +++ b/modules/angular2/src/change_detection/parser/parser.ts @@ -122,24 +122,24 @@ export class Parser { } export class _ParseAST { - index: int = 0; + index: number = 0; constructor(public input: string, public location: any, public tokens: List, public reflector: Reflector, public parseAction: boolean) {} - peek(offset: int): Token { + peek(offset: number): Token { var i = this.index + offset; return i < this.tokens.length ? this.tokens[i] : EOF; } get next(): Token { return this.peek(0); } - get inputIndex(): int { + get inputIndex(): number { return (this.index < this.tokens.length) ? this.next.index : this.input.length; } advance() { this.index++; } - optionalCharacter(code: int): boolean { + optionalCharacter(code: number): boolean { if (this.next.isCharacter(code)) { this.advance(); return true; @@ -159,7 +159,7 @@ export class _ParseAST { peekKeywordVar(): boolean { return this.next.isKeywordVar() || this.next.isOperator('#'); } - expectCharacter(code: int) { + expectCharacter(code: number) { if (this.optionalCharacter(code)) return; this.error(`Missing expected ${StringWrapper.fromCharCode(code)}`); } @@ -453,7 +453,7 @@ export class _ParseAST { throw new BaseException("Fell through all cases in parsePrimary"); } - parseExpressionList(terminator: int): List { + parseExpressionList(terminator: number): List { var result = []; if (!this.next.isCharacter(terminator)) { do { @@ -606,7 +606,7 @@ export class _ParseAST { return bindings; } - error(message: string, index: int = null) { + error(message: string, index: number = null) { if (isBlank(index)) index = this.index; var location = (index < this.tokens.length) ? `at column ${this.tokens[index].index + 1} in` : diff --git a/modules/angular2/src/core/compiler/element_binder.ts b/modules/angular2/src/core/compiler/element_binder.ts index 7a2676c008..6f93f5908d 100644 --- a/modules/angular2/src/core/compiler/element_binder.ts +++ b/modules/angular2/src/core/compiler/element_binder.ts @@ -7,7 +7,7 @@ export class ElementBinder { // updated later, so we are able to resolve cycles nestedProtoView: viewModule.AppProtoView = null; - constructor(public index: int, public parent: ElementBinder, public distanceToParent: int, + constructor(public index: number, public parent: ElementBinder, public distanceToParent: number, public protoElementInjector: eiModule.ProtoElementInjector, public componentDirective: DirectiveBinding) { if (isBlank(index)) { diff --git a/modules/angular2/src/core/compiler/element_injector.ts b/modules/angular2/src/core/compiler/element_injector.ts index 488644f197..1795081369 100644 --- a/modules/angular2/src/core/compiler/element_injector.ts +++ b/modules/angular2/src/core/compiler/element_injector.ts @@ -378,8 +378,9 @@ export class ProtoElementInjector { - constructor(public parent: ProtoElementInjector, public index: int, bwv: BindingWithVisibility[], - public distanceToParent: number, public _firstBindingIsComponent: boolean, + constructor(public parent: ProtoElementInjector, public index: number, + bwv: BindingWithVisibility[], public distanceToParent: number, + public _firstBindingIsComponent: boolean, public directiveVariableBindings: Map) { var length = bwv.length; diff --git a/modules/angular2/src/core/compiler/view.ts b/modules/angular2/src/core/compiler/view.ts index dbcb8777ec..5c2a7c04cf 100644 --- a/modules/angular2/src/core/compiler/view.ts +++ b/modules/angular2/src/core/compiler/view.ts @@ -162,9 +162,9 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher { * * @param {string} eventName * @param {*} eventObj - * @param {int} boundElementIndex + * @param {number} boundElementIndex */ - triggerEventHandlers(eventName: string, eventObj: Event, boundElementIndex: int): void { + triggerEventHandlers(eventName: string, eventObj: Event, boundElementIndex: number): void { var locals = new Map(); locals.set('$event', eventObj); this.dispatchEvent(boundElementIndex, eventName, locals); @@ -328,7 +328,7 @@ export class AppProtoView { } } - bindElement(parent: ElementBinder, distanceToParent: int, + bindElement(parent: ElementBinder, distanceToParent: number, protoElementInjector: ProtoElementInjector, componentDirective: DirectiveBinding = null): ElementBinder { var elBinder = new ElementBinder(this.elementBinders.length, parent, distanceToParent, diff --git a/modules/angular2/src/facade/async.ts b/modules/angular2/src/facade/async.ts index 0c582bce45..67e32b5741 100644 --- a/modules/angular2/src/facade/async.ts +++ b/modules/angular2/src/facade/async.ts @@ -58,11 +58,13 @@ export class PromiseWrapper { } export class TimerWrapper { - static setTimeout(fn: Function, millis: int): int { return global.setTimeout(fn, millis); } - static clearTimeout(id: int): void { global.clearTimeout(id); } + static setTimeout(fn: Function, millis: number): number { return global.setTimeout(fn, millis); } + static clearTimeout(id: number): void { global.clearTimeout(id); } - static setInterval(fn: Function, millis: int): int { return global.setInterval(fn, millis); } - static clearInterval(id: int): void { global.clearInterval(id); } + static setInterval(fn: Function, millis: number): number { + return global.setInterval(fn, millis); + } + static clearInterval(id: number): void { global.clearInterval(id); } } export class ObservableWrapper { diff --git a/modules/angular2/src/facade/intl.ts b/modules/angular2/src/facade/intl.ts index 27ed8d1dc2..3a8c983a5f 100644 --- a/modules/angular2/src/facade/intl.ts +++ b/modules/angular2/src/facade/intl.ts @@ -51,9 +51,9 @@ export class NumberFormatter { static format(number: number, locale: string, style: NumberFormatStyle, {minimumIntegerDigits = 1, minimumFractionDigits = 0, maximumFractionDigits = 3, currency, currencyAsSymbol = false}: { - minimumIntegerDigits?: int, - minimumFractionDigits?: int, - maximumFractionDigits?: int, + minimumIntegerDigits?: number, + minimumFractionDigits?: number, + maximumFractionDigits?: number, currency?: string, currencyAsSymbol?: boolean } = {}): string { @@ -71,10 +71,10 @@ export class NumberFormatter { } } -function digitCondition(len: int): string { +function digitCondition(len: number): string { return len == 2 ? '2-digit' : 'numeric'; } -function nameCondition(len: int): string { +function nameCondition(len: number): string { return len < 4 ? 'short' : 'long'; } function extractComponents(pattern: string): Intl.DateTimeFormatOptions { diff --git a/modules/angular2/src/facade/lang.dart b/modules/angular2/src/facade/lang.dart index c561285437..fa071bcda0 100644 --- a/modules/angular2/src/facade/lang.dart +++ b/modules/angular2/src/facade/lang.dart @@ -50,7 +50,7 @@ int serializeEnum(val) { * val should be the indexed value of the enum (sa returned from @Link{serializeEnum}) * values should be a map from indexes to values for the enum that you want to deserialize. */ -dynamic deserializeEnum(int val, Map values) { +dynamic deserializeEnum(num val, Map values) { return values[val]; } diff --git a/modules/angular2/src/facade/lang.ts b/modules/angular2/src/facade/lang.ts index 7714db62fd..abed296589 100644 --- a/modules/angular2/src/facade/lang.ts +++ b/modules/angular2/src/facade/lang.ts @@ -53,7 +53,7 @@ _global.assert = function assert(condition) { } }; -export function ENUM_INDEX(value: int): int { +export function ENUM_INDEX(value: number): number { return value; } @@ -139,18 +139,18 @@ 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): int { +export function serializeEnum(val): number { return val; } -export function deserializeEnum(val, values: Map): any { +export function deserializeEnum(val, values: Map): any { return val; } export class StringWrapper { - static fromCharCode(code: int): string { return String.fromCharCode(code); } + static fromCharCode(code: number): string { return String.fromCharCode(code); } - static charCodeAt(s: string, index: int): number { return s.charCodeAt(index); } + static charCodeAt(s: string, index: number): number { return s.charCodeAt(index); } static split(s: string, regExp: RegExp): List { return s.split(regExp); } @@ -170,7 +170,7 @@ export class StringWrapper { static startsWith(s: string, start: string): boolean { return s.startsWith(start); } - static substring(s: string, start: int, end: int = null): string { + static substring(s: string, start: number, end: number = null): string { return s.substring(start, end === null ? undefined : end); } @@ -185,7 +185,7 @@ export class StringWrapper { static contains(s: string, substr: string): boolean { return s.indexOf(substr) != -1; } - static compare(a: string, b: string): int { + static compare(a: string, b: string): number { if (a < b) { return -1; } else if (a > b) { @@ -214,19 +214,19 @@ export class NumberParseError extends BaseException { export class NumberWrapper { - static toFixed(n: number, fractionDigits: int): string { return n.toFixed(fractionDigits); } + static toFixed(n: number, fractionDigits: number): string { return n.toFixed(fractionDigits); } static equal(a: number, b: number): boolean { return a === b; } - static parseIntAutoRadix(text: string): int { - var result: int = parseInt(text); + static parseIntAutoRadix(text: string): number { + var result: number = parseInt(text); if (isNaN(result)) { throw new NumberParseError("Invalid integer literal when parsing " + text); } return result; } - static parseInt(text: string, radix: int): int { + static parseInt(text: string, radix: number): number { if (radix == 10) { if (/^(\-|\+)?[0-9]+$/.test(text)) { return parseInt(text, radix); @@ -236,7 +236,7 @@ export class NumberWrapper { return parseInt(text, radix); } } else { - var result: int = parseInt(text, radix); + var result: number = parseInt(text, radix); if (!isNaN(result)) { return result; } @@ -338,12 +338,12 @@ export class Json { } export class DateWrapper { - static create(year: int, month: int = 1, day: int = 1, hour: int = 0, minutes: int = 0, - seconds: int = 0, milliseconds: int = 0): Date { + static create(year: number, month: number = 1, day: number = 1, hour: number = 0, + minutes: number = 0, seconds: number = 0, milliseconds: number = 0): Date { return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds); } - static fromMillis(ms: int): Date { return new Date(ms); } - static toMillis(date: Date): int { return date.getTime(); } + static fromMillis(ms: number): Date { return new Date(ms); } + static toMillis(date: Date): number { return date.getTime(); } static now(): Date { return new Date(); } static toJson(date: Date): string { return date.toJSON(); } } diff --git a/modules/angular2/src/pipes/limit_to_pipe.ts b/modules/angular2/src/pipes/limit_to_pipe.ts index 7cd2bccdeb..c2645884d0 100644 --- a/modules/angular2/src/pipes/limit_to_pipe.ts +++ b/modules/angular2/src/pipes/limit_to_pipe.ts @@ -67,7 +67,7 @@ export class LimitToPipe implements PipeTransform { throw new InvalidPipeArgumentException(LimitToPipe, value); } if (isBlank(value)) return value; - var limit: int = args[0]; + var limit: number = args[0]; var left = 0, right = Math.min(limit, value.length); if (limit < 0) { left = Math.max(0, value.length + limit); diff --git a/modules/angular2/src/web-workers/shared/serializer.ts b/modules/angular2/src/web-workers/shared/serializer.ts index 2ed922ed83..9d8940accf 100644 --- a/modules/angular2/src/web-workers/shared/serializer.ts +++ b/modules/angular2/src/web-workers/shared/serializer.ts @@ -42,24 +42,24 @@ import { @Injectable() export class Serializer { - private _enumRegistry: Map>; + private _enumRegistry: Map>; constructor(private _parser: Parser, private _protoViewStore: RenderProtoViewRefStore, private _renderViewStore: RenderViewWithFragmentsStore) { - this._enumRegistry = new Map>(); + this._enumRegistry = new Map>(); - var viewTypeMap = new Map(); + var viewTypeMap = new Map(); viewTypeMap[0] = ViewType.HOST; viewTypeMap[1] = ViewType.COMPONENT; viewTypeMap[2] = ViewType.EMBEDDED; this._enumRegistry.set(ViewType, viewTypeMap); - var viewEncapsulationMap = new Map(); + var viewEncapsulationMap = new Map(); viewEncapsulationMap[0] = ViewEncapsulation.EMULATED; viewEncapsulationMap[1] = ViewEncapsulation.NATIVE; viewEncapsulationMap[2] = ViewEncapsulation.NONE; this._enumRegistry.set(ViewEncapsulation, viewEncapsulationMap); - var propertyBindingTypeMap = new Map(); + var propertyBindingTypeMap = new Map(); propertyBindingTypeMap[0] = PropertyBindingType.PROPERTY; propertyBindingTypeMap[1] = PropertyBindingType.ATTRIBUTE; propertyBindingTypeMap[2] = PropertyBindingType.CLASS; diff --git a/modules/angular2/test/change_detection/iterable.ts b/modules/angular2/test/change_detection/iterable.ts index a322db6e66..17539b257f 100644 --- a/modules/angular2/test/change_detection/iterable.ts +++ b/modules/angular2/test/change_detection/iterable.ts @@ -1,7 +1,7 @@ import {List} from 'angular2/src/facade/collection'; export class TestIterable { - list: List; + list: List; constructor() { this.list = []; } [Symbol.iterator]() { return this.list[Symbol.iterator](); } diff --git a/modules/angular2/test/change_detection/parser/lexer_spec.ts b/modules/angular2/test/change_detection/parser/lexer_spec.ts index c852d40861..c97602e2a1 100644 --- a/modules/angular2/test/change_detection/parser/lexer_spec.ts +++ b/modules/angular2/test/change_detection/parser/lexer_spec.ts @@ -53,13 +53,13 @@ export function main() { describe('lexer', function() { describe('token', function() { it('should tokenize a simple identifier', function() { - var tokens: List = lex("j"); + var tokens: List = lex("j"); expect(tokens.length).toEqual(1); expectIdentifierToken(tokens[0], 0, 'j'); }); it('should tokenize a dotted identifier', function() { - var tokens: List = lex("j.k"); + var tokens: List = lex("j.k"); expect(tokens.length).toEqual(3); expectIdentifierToken(tokens[0], 0, 'j'); expectCharacterToken(tokens[1], 1, '.'); @@ -67,20 +67,20 @@ export function main() { }); it('should tokenize an operator', function() { - var tokens: List = lex("j-k"); + var tokens: List = lex("j-k"); expect(tokens.length).toEqual(3); expectOperatorToken(tokens[1], 1, '-'); }); it('should tokenize an indexed operator', function() { - var tokens: List = lex("j[k]"); + var tokens: List = lex("j[k]"); expect(tokens.length).toEqual(4); expectCharacterToken(tokens[1], 1, "["); expectCharacterToken(tokens[3], 3, "]"); }); it('should tokenize numbers', function() { - var tokens: List = lex("88"); + var tokens: List = lex("88"); expect(tokens.length).toEqual(1); expectNumberToken(tokens[0], 0, 88); }); diff --git a/modules/angular2/test/facade/collection_spec.ts b/modules/angular2/test/facade/collection_spec.ts index 2d0a5ed578..161a1259cf 100644 --- a/modules/angular2/test/facade/collection_spec.ts +++ b/modules/angular2/test/facade/collection_spec.ts @@ -10,7 +10,7 @@ import { export function main() { describe('ListWrapper', () => { - var l: List; + var l: List; describe('splice', () => { it('should remove sublist of given length and return it', () => { diff --git a/modules/angular2_material/src/components/grid_list/grid_list.ts b/modules/angular2_material/src/components/grid_list/grid_list.ts index 0058ccde66..f1291a21e8 100644 --- a/modules/angular2_material/src/components/grid_list/grid_list.ts +++ b/modules/angular2_material/src/components/grid_list/grid_list.ts @@ -302,13 +302,13 @@ export class MdGridTile { */ class TileCoordinator { // Tracking array (see class description). - tracker: List; + tracker: List; // Index at which the search for the next gap will start. - columnIndex: int; + columnIndex: number; // The current row index. - rowIndex: int; + rowIndex: number; // The computed (row, col) position of each tile (the output). positions: List; diff --git a/modules/benchmarks/src/naive_infinite_scroll/app.ts b/modules/benchmarks/src/naive_infinite_scroll/app.ts index dbe2e17d05..c8af2b18c4 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/app.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/app.ts @@ -25,9 +25,9 @@ import {Component, Directive, View} from 'angular2/angular2'; ` }) export class App { - scrollAreas: List; - iterationCount: int; - scrollIncrement: int; + scrollAreas: List; + iterationCount: number; + scrollIncrement: number; constructor() { var appSize = getIntParameter('appSize'); @@ -50,7 +50,7 @@ export class App { runBenchmark() { var scrollDiv = this._getScrollDiv(); - var n: int = this.iterationCount; + var n: number = this.iterationCount; var scheduleScroll; scheduleScroll = () => { TimerWrapper.setTimeout(() => { diff --git a/modules/benchmarks/src/naive_infinite_scroll/cells.ts b/modules/benchmarks/src/naive_infinite_scroll/cells.ts index af0097bd12..ee0b36160b 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/cells.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/cells.ts @@ -5,11 +5,11 @@ import {NgFor} from 'angular2/directives'; import {Component, Directive, View} from 'angular2/angular2'; export class HasStyle { - cellWidth: int; + cellWidth: number; constructor() {} - set width(w: int) { this.cellWidth = w; } + set width(w: number) { this.cellWidth = w; } } @Component({selector: 'company-name', properties: ['width: cell-width', 'company']}) diff --git a/modules/benchmarks/src/naive_infinite_scroll/random_data.ts b/modules/benchmarks/src/naive_infinite_scroll/random_data.ts index 80c859b7e0..1795df9655 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/random_data.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/random_data.ts @@ -10,7 +10,7 @@ import { AAT_STATUS_LIST } from './common'; -export function generateOfferings(count: int): List { +export function generateOfferings(count: number): List { var res = []; for (var i = 0; i < count; i++) { res.push(generateOffering(i)); @@ -18,7 +18,7 @@ export function generateOfferings(count: int): List { return res; } -export function generateOffering(seed: int): Offering { +export function generateOffering(seed: number): Offering { var res = new Offering(); res.name = generateName(seed++); res.company = generateCompany(seed++); @@ -34,19 +34,19 @@ export function generateOffering(seed: int): Offering { return res; } -export function generateCompany(seed: int): Company { +export function generateCompany(seed: number): Company { var res = new Company(); res.name = generateName(seed); return res; } -export function generateOpportunity(seed: int): Opportunity { +export function generateOpportunity(seed: number): Opportunity { var res = new Opportunity(); res.name = generateName(seed); return res; } -export function generateAccount(seed: int): Account { +export function generateAccount(seed: number): Account { var res = new Account(); res.accountId = seed; return res; @@ -68,13 +68,13 @@ var names = [ 'Stuff' ]; -function generateName(seed: int): string { +function generateName(seed: number): string { return names[seed % names.length]; } var offsets = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; -function randomDate(seed: int, minDate: CustomDate = null): CustomDate { +function randomDate(seed: number, minDate: CustomDate = null): CustomDate { if (minDate == null) { minDate = CustomDate.now(); } @@ -85,7 +85,7 @@ function randomDate(seed: int, minDate: CustomDate = null): CustomDate { var stringLengths = [5, 7, 9, 11, 13]; var charCodeOffsets = [0, 1, 2, 3, 4, 5, 6, 7, 8]; -function randomString(seed: int): string { +function randomString(seed: number): string { var len = stringLengths[seed % 5]; var str = ''; for (var i = 0; i < len; i++) { diff --git a/modules/benchpress/src/metric/perflog_metric.ts b/modules/benchpress/src/metric/perflog_metric.ts index 1fdf577b38..b2dfb47f77 100644 --- a/modules/benchpress/src/metric/perflog_metric.ts +++ b/modules/benchpress/src/metric/perflog_metric.ts @@ -25,7 +25,7 @@ export class PerflogMetric extends Metric { static get SET_TIMEOUT(): OpaqueToken { return _SET_TIMEOUT; } private _remainingEvents: List>; - private _measureCount: int; + private _measureCount: number; _perfLogFeatures: PerfLogFeatures; @@ -124,7 +124,7 @@ export class PerflogMetric extends Metric { .then((_) => this._readUntilEndMark(markName)); } - _readUntilEndMark(markName: string, loopCount: int = 0, startEvent = null) { + _readUntilEndMark(markName: string, loopCount: number = 0, startEvent = null) { if (loopCount > _MAX_RETRY_COUNT) { throw new BaseException(`Tried too often to get the ending mark: ${loopCount}`); } diff --git a/modules/http/src/enums.ts b/modules/http/src/enums.ts index e2da8affba..81e4afe7ee 100644 --- a/modules/http/src/enums.ts +++ b/modules/http/src/enums.ts @@ -51,7 +51,7 @@ export enum RequestMethods { export class RequestMethodsMap { private _methods: List; constructor() { this._methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH']; } - getMethod(method: int): string { return this._methods[method]; } + getMethod(method: number): string { return this._methods[method]; } } /** * All possible states in which a connection can be, based on