diff --git a/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html b/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html index 48add36249..6495d6616e 100644 --- a/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html +++ b/docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html @@ -1,7 +1,6 @@ {% extends '../type-definition.template.html' %} {% block staticDeclarations %} -interface List extends Array {} interface Map {} interface StringMap extends Map {} diff --git a/modules/angular2/directives.ts b/modules/angular2/directives.ts index 0206a2daf4..94ab8d63b7 100644 --- a/modules/angular2/directives.ts +++ b/modules/angular2/directives.ts @@ -60,5 +60,5 @@ export * from './src/core/directives/ng_switch'; * ``` * */ -export const CORE_DIRECTIVES: List = +export const CORE_DIRECTIVES: Type[] = CONST_EXPR([NgClass, NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]); diff --git a/modules/angular2/forms.ts b/modules/angular2/forms.ts index 238df34a15..abee111adb 100644 --- a/modules/angular2/forms.ts +++ b/modules/angular2/forms.ts @@ -39,4 +39,4 @@ export {FormBuilder} from './src/forms/form_builder'; import {FormBuilder} from './src/forms/form_builder'; import {CONST_EXPR, Type} from './src/core/facade/lang'; -export const FORM_BINDINGS: List = CONST_EXPR([FormBuilder]); +export const FORM_BINDINGS: Type[] = CONST_EXPR([FormBuilder]); diff --git a/modules/angular2/globals.d.ts b/modules/angular2/globals.d.ts index a0f11f9223..9e1b5c3151 100644 --- a/modules/angular2/globals.d.ts +++ b/modules/angular2/globals.d.ts @@ -5,11 +5,9 @@ /// declare var assert: any; -interface List extends Array {} - // FIXME: K must be string! // FIXME: should have an index signature, `[k: string]: V;` -interface StringMap {} +interface StringMap {} interface BrowserNodeGlobal { Object: typeof Object; diff --git a/modules/angular2/http.ts b/modules/angular2/http.ts index d0c7673ef6..fbbf55c168 100644 --- a/modules/angular2/http.ts +++ b/modules/angular2/http.ts @@ -62,7 +62,7 @@ export {EventEmitter, Observable} from './src/core/facade/async'; * ``` * */ -export const HTTP_BINDINGS: List = [ +export const HTTP_BINDINGS: any[] = [ // TODO(pascal): use factory type annotations once supported in DI // issue: https://github.com/angular/angular/issues/3183 bind(Http) @@ -74,7 +74,7 @@ export const HTTP_BINDINGS: List = [ XHRBackend ]; -export const JSONP_BINDINGS: List = [ +export const JSONP_BINDINGS: any[] = [ // TODO(pascal): use factory type annotations once supported in DI // issue: https://github.com/angular/angular/issues/3183 bind(Jsonp) diff --git a/modules/angular2/router.ts b/modules/angular2/router.ts index 36baaff602..a1f6a22a3f 100644 --- a/modules/angular2/router.ts +++ b/modules/angular2/router.ts @@ -35,11 +35,10 @@ import {Location} from './src/router/location'; import {APP_COMPONENT} from './src/core/application_tokens'; import {Binding} from './di'; import {CONST_EXPR} from './src/core/facade/lang'; -import {List} from './src/core/facade/collection'; -export const ROUTER_DIRECTIVES: List = CONST_EXPR([RouterOutlet, RouterLink]); +export const ROUTER_DIRECTIVES: any[] = CONST_EXPR([RouterOutlet, RouterLink]); -export const ROUTER_BINDINGS: List = CONST_EXPR([ +export const ROUTER_BINDINGS: any[] = CONST_EXPR([ RouteRegistry, Pipeline, CONST_EXPR(new Binding(LocationStrategy, {toClass: PathLocationStrategy})), diff --git a/modules/angular2/src/compiler/html_parser.ts b/modules/angular2/src/compiler/html_parser.ts index beea26d27a..654da00937 100644 --- a/modules/angular2/src/compiler/html_parser.ts +++ b/modules/angular2/src/compiler/html_parser.ts @@ -1,4 +1,3 @@ -import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import { isPresent, StringWrapper, @@ -56,8 +55,8 @@ function parseAttrs(element: Element, elementSourceInfo: string): HtmlAttrAst[] // in DOM parsers! var attrMap = DOM.attributeMap(element); var attrList: string[][] = []; - MapWrapper.forEach(attrMap, (value, name) => { attrList.push([name, value]); }); - ListWrapper.sort(attrList, (entry1, entry2) => StringWrapper.compare(entry1[0], entry2[0])); + attrMap.forEach((value, name) => attrList.push([name, value])); + attrList.sort((entry1, entry2) => StringWrapper.compare(entry1[0], entry2[0])); return attrList.map(entry => parseAttr(element, elementSourceInfo, entry[0], entry[1])); } diff --git a/modules/angular2/src/core/application_common.ts b/modules/angular2/src/core/application_common.ts index 74816e7cf4..199a442c30 100644 --- a/modules/angular2/src/core/application_common.ts +++ b/modules/angular2/src/core/application_common.ts @@ -33,7 +33,7 @@ import {StyleInliner} from 'angular2/src/core/render/dom/compiler/style_inliner' import {ViewResolver} from './compiler/view_resolver'; import {DirectiveResolver} from './compiler/directive_resolver'; import {PipeResolver} from './compiler/pipe_resolver'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async'; import {NgZone} from 'angular2/src/core/zone/ng_zone'; import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle'; @@ -84,7 +84,7 @@ var _rootInjector: Injector; // Contains everything that is safe to share between applications. var _rootBindings = [bind(Reflector).toValue(reflector), TestabilityRegistry]; -function _injectorBindings(appComponentType): List> { +function _injectorBindings(appComponentType): Array { var bestChangeDetection = new DynamicChangeDetection(); if (PreGeneratedChangeDetection.isSupported()) { bestChangeDetection = new PreGeneratedChangeDetection(); @@ -290,9 +290,9 @@ export function createNgZone(): NgZone { * * Returns a `Promise` of {@link ApplicationRef}. */ -export function commonBootstrap( - appComponentType: /*Type*/ any, - componentInjectableBindings: List> = null): Promise { +export function commonBootstrap(appComponentType: /*Type*/ any, + componentInjectableBindings: Array = null): + Promise { BrowserDomAdapter.makeCurrent(); wtfInit(); var bootstrapProcess = PromiseWrapper.completer(); @@ -338,7 +338,7 @@ export function commonBootstrap( return bootstrapProcess.promise; } -function _createAppInjector(appComponentType: Type, bindings: List>, +function _createAppInjector(appComponentType: Type, bindings: Array, zone: NgZone): Injector { if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings); var mergedBindings: any[] = diff --git a/modules/angular2/src/core/change_detection/abstract_change_detector.ts b/modules/angular2/src/core/change_detection/abstract_change_detector.ts index baf66e1f32..465b49a5e1 100644 --- a/modules/angular2/src/core/change_detection/abstract_change_detector.ts +++ b/modules/angular2/src/core/change_detection/abstract_change_detector.ts @@ -1,5 +1,5 @@ import {isPresent, isBlank, BaseException, StringWrapper} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {ChangeDetectionUtil} from './change_detection_util'; import {ChangeDetectorRef} from './change_detector_ref'; import {DirectiveIndex} from './directive_record'; @@ -25,8 +25,8 @@ class _Context { } export class AbstractChangeDetector implements ChangeDetector { - lightDomChildren: List = []; - shadowDomChildren: List = []; + lightDomChildren: any[] = []; + shadowDomChildren: any[] = []; parent: ChangeDetector; ref: ChangeDetectorRef; diff --git a/modules/angular2/src/core/change_detection/change_detection.ts b/modules/angular2/src/core/change_detection/change_detection.ts index 0644e3188b..449ecf11ee 100644 --- a/modules/angular2/src/core/change_detection/change_detection.ts +++ b/modules/angular2/src/core/change_detection/change_detection.ts @@ -12,7 +12,7 @@ import { ChangeDetectorGenConfig } from './interfaces'; import {Injector, Inject, Injectable, OpaqueToken, Optional, Binding} from 'angular2/di'; -import {List, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; import { CONST, CONST_EXPR, diff --git a/modules/angular2/src/core/change_detection/change_detection_jit_generator.ts b/modules/angular2/src/core/change_detection/change_detection_jit_generator.ts index 4cddcfb356..28f44c9794 100644 --- a/modules/angular2/src/core/change_detection/change_detection_jit_generator.ts +++ b/modules/angular2/src/core/change_detection/change_detection_jit_generator.ts @@ -1,5 +1,5 @@ import {BaseException, Type, isBlank, isPresent} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {AbstractChangeDetector} from './abstract_change_detector'; import {ChangeDetectionUtil} from './change_detection_util'; @@ -36,8 +36,8 @@ export class ChangeDetectorJITGenerator { _typeName: string; constructor(private id: string, private changeDetectionStrategy: ChangeDetectionStrategy, - private records: List, private propertyBindingTargets: BindingTarget[], - private eventBindings: EventBinding[], private directiveRecords: List, + private records: ProtoRecord[], private propertyBindingTargets: BindingTarget[], + private eventBindings: EventBinding[], private directiveRecords: any[], private genConfig: ChangeDetectorGenConfig) { this._names = new CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, UTIL); diff --git a/modules/angular2/src/core/change_detection/change_detection_util.ts b/modules/angular2/src/core/change_detection/change_detection_util.ts index 043ed68507..3293916314 100644 --- a/modules/angular2/src/core/change_detection/change_detection_util.ts +++ b/modules/angular2/src/core/change_detection/change_detection_util.ts @@ -6,7 +6,7 @@ import { Type, StringWrapper } from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {ProtoRecord} from './proto_record'; import {ChangeDetectionStrategy, isDefaultChangeDetectionStrategy} from './constants'; import {implementsOnDestroy} from './pipe_lifecycle_reflector'; @@ -128,7 +128,7 @@ export class ChangeDetectionUtil { static operation_logical_or(left, right): any { return left || right; } static cond(cond, trueVal, falseVal): any { return cond ? trueVal : falseVal; } - static mapFn(keys: List): any { + static mapFn(keys: any[]): any { function buildMap(values): StringMap { var res = StringMapWrapper.create(); for (var i = 0; i < keys.length; ++i) { diff --git a/modules/angular2/src/core/change_detection/coalesce.ts b/modules/angular2/src/core/change_detection/coalesce.ts index b22f1df9b9..6c7fb8de80 100644 --- a/modules/angular2/src/core/change_detection/coalesce.ts +++ b/modules/angular2/src/core/change_detection/coalesce.ts @@ -1,5 +1,5 @@ import {isPresent, isBlank, looseIdentical} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, Map} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map} from 'angular2/src/core/facade/collection'; import {RecordType, ProtoRecord} from './proto_record'; /** @@ -13,7 +13,7 @@ import {RecordType, ProtoRecord} from './proto_record'; * replaced with very cheap SELF records. */ export function coalesce(records: ProtoRecord[]): ProtoRecord[] { - var res: List = []; + var res: ProtoRecord[] = []; var indexMap: Map = new Map(); for (var i = 0; i < records.length; ++i) { @@ -48,7 +48,7 @@ function _selfRecord(r: ProtoRecord, contextIndex: number, selfIndex: number): P r.lastInDirective, false, false, r.propertyBindingIndex); } -function _findMatching(r: ProtoRecord, rs: List) { +function _findMatching(r: ProtoRecord, rs: ProtoRecord[]) { return ListWrapper.find( rs, (rr) => rr.mode !== RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && looseIdentical(rr.funcOrValue, r.funcOrValue) && diff --git a/modules/angular2/src/core/change_detection/codegen_facade.ts b/modules/angular2/src/core/change_detection/codegen_facade.ts index d593e11daa..2ff2cad549 100644 --- a/modules/angular2/src/core/change_detection/codegen_facade.ts +++ b/modules/angular2/src/core/change_detection/codegen_facade.ts @@ -1,4 +1,3 @@ -import {List} from 'angular2/src/core/facade/collection'; /** * Converts `funcOrValue` to a string which can be used in generated code. diff --git a/modules/angular2/src/core/change_detection/codegen_name_util.ts b/modules/angular2/src/core/change_detection/codegen_name_util.ts index ca352501b9..c9781dfdb5 100644 --- a/modules/angular2/src/core/change_detection/codegen_name_util.ts +++ b/modules/angular2/src/core/change_detection/codegen_name_util.ts @@ -1,5 +1,5 @@ import {RegExpWrapper, StringWrapper} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, MapWrapper, Map} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, Map} from 'angular2/src/core/facade/collection'; import {DirectiveIndex} from './directive_record'; @@ -41,11 +41,11 @@ export class CodegenNameUtil { * Record names sanitized for use as fields. * See [sanitizeName] for details. */ - _sanitizedNames: List; - _sanitizedEventNames: Map>; + _sanitizedNames: string[]; + _sanitizedEventNames: Map; - constructor(private records: List, private eventBindings: EventBinding[], - private directiveRecords: List, private utilName: string) { + constructor(private records: ProtoRecord[], private eventBindings: EventBinding[], + private directiveRecords: any[], private utilName: string) { this._sanitizedNames = ListWrapper.createFixedSize(this.records.length + 1); this._sanitizedNames[CONTEXT_INDEX] = _CONTEXT_ACCESSOR; for (var i = 0, iLen = this.records.length; i < iLen; ++i) { @@ -135,7 +135,7 @@ export class CodegenNameUtil { getFieldName(idx: number): string { return this._addFieldPrefix(this._sanitizedNames[idx]); } - getAllFieldNames(): List { + getAllFieldNames(): string[] { var fieldList = []; for (var k = 0, kLen = this.getFieldCount(); k < kLen; ++k) { if (k === 0 || this.records[k - 1].shouldBeChecked()) { diff --git a/modules/angular2/src/core/change_detection/dynamic_change_detector.ts b/modules/angular2/src/core/change_detection/dynamic_change_detector.ts index 1cb9b1152b..77e0d249bb 100644 --- a/modules/angular2/src/core/change_detection/dynamic_change_detector.ts +++ b/modules/angular2/src/core/change_detection/dynamic_change_detector.ts @@ -5,7 +5,7 @@ import { FunctionWrapper, StringWrapper } from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {AbstractChangeDetector} from './abstract_change_detector'; import {EventBinding} from './event_binding'; @@ -18,10 +18,10 @@ import {ChangeDetectionStrategy} from './constants'; import {ProtoRecord, RecordType} from './proto_record'; export class DynamicChangeDetector extends AbstractChangeDetector { - values: List; - changes: List; - localPipes: List; - prevContexts: List; + values: any[]; + changes: any[]; + localPipes: any[]; + prevContexts: any[]; directives: any = null; constructor(id: string, dispatcher: any, numberOfPropertyProtoRecords: number, diff --git a/modules/angular2/src/core/change_detection/interfaces.ts b/modules/angular2/src/core/change_detection/interfaces.ts index 2c074fbe30..7efe7e8f63 100644 --- a/modules/angular2/src/core/change_detection/interfaces.ts +++ b/modules/angular2/src/core/change_detection/interfaces.ts @@ -1,4 +1,3 @@ -import {List} from 'angular2/src/core/facade/collection'; import {CONST} from 'angular2/src/core/facade/lang'; import {Locals} from './parser/locals'; import {BindingTarget, BindingRecord} from './binding_record'; @@ -83,7 +82,7 @@ export class ChangeDetectorGenConfig { export class ChangeDetectorDefinition { constructor(public id: string, public strategy: ChangeDetectionStrategy, - public variableNames: List, public bindingRecords: BindingRecord[], + public variableNames: string[], public bindingRecords: BindingRecord[], public eventRecords: BindingRecord[], public directiveRecords: DirectiveRecord[], public genConfig: ChangeDetectorGenConfig) {} } diff --git a/modules/angular2/src/core/change_detection/parser/ast.ts b/modules/angular2/src/core/change_detection/parser/ast.ts index 7dbe59c35f..82fb8b48af 100644 --- a/modules/angular2/src/core/change_detection/parser/ast.ts +++ b/modules/angular2/src/core/change_detection/parser/ast.ts @@ -1,5 +1,5 @@ import {isBlank, isPresent, FunctionWrapper, BaseException} from "angular2/src/core/facade/lang"; -import {List, Map, ListWrapper, StringMapWrapper} from "angular2/src/core/facade/collection"; +import {Map, ListWrapper, StringMapWrapper} from "angular2/src/core/facade/collection"; export class AST { visit(visitor: AstVisitor): any { return null; } @@ -20,7 +20,7 @@ export class ImplicitReceiver extends AST { * Multiple expressions separated by a semicolon. */ export class Chain extends AST { - constructor(public expressions: List) { super(); } + constructor(public expressions: any[]) { super(); } visit(visitor: AstVisitor): any { return visitor.visitChain(this); } } @@ -63,7 +63,7 @@ export class KeyedWrite extends AST { } export class BindingPipe extends AST { - constructor(public exp: AST, public name: string, public args: List) { super(); } + constructor(public exp: AST, public name: string, public args: any[]) { super(); } visit(visitor: AstVisitor): any { return visitor.visitPipe(this); } } @@ -74,17 +74,17 @@ export class LiteralPrimitive extends AST { } export class LiteralArray extends AST { - constructor(public expressions: List) { super(); } + constructor(public expressions: any[]) { super(); } visit(visitor: AstVisitor): any { return visitor.visitLiteralArray(this); } } export class LiteralMap extends AST { - constructor(public keys: List, public values: List) { super(); } + constructor(public keys: any[], public values: any[]) { super(); } visit(visitor: AstVisitor): any { return visitor.visitLiteralMap(this); } } export class Interpolation extends AST { - constructor(public strings: List, public expressions: List) { super(); } + constructor(public strings: any[], public expressions: any[]) { super(); } visit(visitor: AstVisitor) { visitor.visitInterpolation(this); } } @@ -99,23 +99,21 @@ export class PrefixNot extends AST { } export class MethodCall extends AST { - constructor(public receiver: AST, public name: string, public fn: Function, - public args: List) { + constructor(public receiver: AST, public name: string, public fn: Function, public args: any[]) { super(); } visit(visitor: AstVisitor): any { return visitor.visitMethodCall(this); } } export class SafeMethodCall extends AST { - constructor(public receiver: AST, public name: string, public fn: Function, - public args: List) { + constructor(public receiver: AST, public name: string, public fn: Function, public args: any[]) { super(); } visit(visitor: AstVisitor): any { return visitor.visitSafeMethodCall(this); } } export class FunctionCall extends AST { - constructor(public target: AST, public args: List) { super(); } + constructor(public target: AST, public args: any[]) { super(); } visit(visitor: AstVisitor): any { return visitor.visitFunctionCall(this); } } @@ -222,7 +220,7 @@ export class RecursiveAstVisitor implements AstVisitor { ast.receiver.visit(this); return this.visitAll(ast.args); } - visitAll(asts: List): any { + visitAll(asts: AST[]): any { ListWrapper.forEach(asts, (ast) => { ast.visit(this); }); return null; } @@ -294,7 +292,7 @@ export class AstTransformer implements AstVisitor { return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); } - visitAll(asts: List): List { + visitAll(asts: any[]): any[] { var res = ListWrapper.createFixedSize(asts.length); for (var i = 0; i < asts.length; ++i) { res[i] = asts[i].visit(this); diff --git a/modules/angular2/src/core/change_detection/parser/lexer.ts b/modules/angular2/src/core/change_detection/parser/lexer.ts index 3f56ac7f9b..86bc29f6fd 100644 --- a/modules/angular2/src/core/change_detection/parser/lexer.ts +++ b/modules/angular2/src/core/change_detection/parser/lexer.ts @@ -1,5 +1,5 @@ import {Injectable} from 'angular2/src/core/di/decorators'; -import {List, ListWrapper, SetWrapper} from "angular2/src/core/facade/collection"; +import {ListWrapper, SetWrapper} from "angular2/src/core/facade/collection"; import { NumberWrapper, StringJoiner, @@ -19,7 +19,7 @@ export enum TokenType { @Injectable() export class Lexer { - tokenize(text: string): List { + tokenize(text: string): any[] { var scanner = new _Scanner(text); var tokens = []; var token = scanner.scanToken(); diff --git a/modules/angular2/src/core/change_detection/parser/parser.ts b/modules/angular2/src/core/change_detection/parser/parser.ts index 40e571fdf1..92cd77b675 100644 --- a/modules/angular2/src/core/change_detection/parser/parser.ts +++ b/modules/angular2/src/core/change_detection/parser/parser.ts @@ -1,6 +1,6 @@ import {Injectable} from 'angular2/src/core/di/decorators'; import {isBlank, isPresent, BaseException, StringWrapper} from 'angular2/src/core/facade/lang'; -import {ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import { Lexer, EOF, @@ -85,7 +85,7 @@ export class Parser { return new ASTWithSource(ast, input, location); } - parseTemplateBindings(input: string, location: any): List { + parseTemplateBindings(input: string, location: any): TemplateBinding[] { var tokens = this._lexer.tokenize(input); return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); } @@ -141,7 +141,7 @@ export class Parser { export class _ParseAST { index: number = 0; - constructor(public input: string, public location: any, public tokens: List, + constructor(public input: string, public location: any, public tokens: any[], public reflector: Reflector, public parseAction: boolean) {} peek(offset: number): Token { @@ -471,7 +471,7 @@ export class _ParseAST { throw new BaseException("Fell through all cases in parsePrimary"); } - parseExpressionList(terminator: number): List { + parseExpressionList(terminator: number): any[] { var result = []; if (!this.next.isCharacter(terminator)) { do { @@ -677,7 +677,7 @@ class SimpleExpressionChecker implements AstVisitor { visitKeyedWrite(ast: KeyedWrite) { this.simple = false; } - visitAll(asts: List): List { + visitAll(asts: any[]): any[] { var res = ListWrapper.createFixedSize(asts.length); for (var i = 0; i < asts.length; ++i) { res[i] = asts[i].visit(this); diff --git a/modules/angular2/src/core/change_detection/pipe_transform.ts b/modules/angular2/src/core/change_detection/pipe_transform.ts index e47526a350..1d354a0fb6 100644 --- a/modules/angular2/src/core/change_detection/pipe_transform.ts +++ b/modules/angular2/src/core/change_detection/pipe_transform.ts @@ -13,7 +13,7 @@ import {ABSTRACT, BaseException, CONST, Type} from 'angular2/src/core/facade/lan * } * ``` */ -export interface PipeTransform { transform(value: any, args: List): any; } +export interface PipeTransform { transform(value: any, args: any[]): any; } /** * An interface that stateful pipes should implement. diff --git a/modules/angular2/src/core/change_detection/proto_change_detector.ts b/modules/angular2/src/core/change_detection/proto_change_detector.ts index 6e5d4bafdb..f8ae74578a 100644 --- a/modules/angular2/src/core/change_detection/proto_change_detector.ts +++ b/modules/angular2/src/core/change_detection/proto_change_detector.ts @@ -1,5 +1,5 @@ import {BaseException, Type, isBlank, isPresent, isString} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import { PropertyRead, @@ -76,7 +76,7 @@ export function createEventRecords(definition: ChangeDetectorDefinition): EventB } export class ProtoRecordBuilder { - records: List; + records: ProtoRecord[]; constructor() { this.records = []; } @@ -117,16 +117,16 @@ export class ProtoRecordBuilder { } class _ConvertAstIntoProtoRecords implements AstVisitor { - constructor(private _records: List, private _bindingRecord: BindingRecord, + constructor(private _records: ProtoRecord[], private _bindingRecord: BindingRecord, private _variableNames: string[], private _bindingIndex: number) {} - static append(records: List, b: BindingRecord, variableNames: string[], + static append(records: ProtoRecord[], b: BindingRecord, variableNames: string[], bindingIndex: number) { var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); b.ast.visit(c); } - static create(b: BindingRecord, variableNames: List): ProtoRecord[] { + static create(b: BindingRecord, variableNames: any[]): ProtoRecord[] { var rec = []; _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); rec[rec.length - 1].lastInBinding = true; @@ -256,7 +256,7 @@ class _ConvertAstIntoProtoRecords implements AstVisitor { visitIf(ast: If) { throw new BaseException('Not supported'); } - _visitAll(asts: List) { + _visitAll(asts: any[]) { var res = ListWrapper.createFixedSize(asts.length); for (var i = 0; i < asts.length; ++i) { res[i] = asts[i].visit(this); @@ -307,7 +307,7 @@ function _arrayFn(length: number): Function { } } -function _mapPrimitiveName(keys: List) { +function _mapPrimitiveName(keys: any[]) { var stringifiedKeys = ListWrapper.join(ListWrapper.map(keys, (k) => isString(k) ? `"${k}"` : `${k}`), ", "); return `mapFn([${stringifiedKeys}])`; @@ -391,7 +391,7 @@ function s(v): string { return isPresent(v) ? `${v}` : ''; } -function _interpolationFn(strings: List) { +function _interpolationFn(strings: any[]) { var length = strings.length; var c0 = length > 0 ? strings[0] : null; var c1 = length > 1 ? strings[1] : null; diff --git a/modules/angular2/src/core/change_detection/proto_record.ts b/modules/angular2/src/core/change_detection/proto_record.ts index f58df466ad..fa5ebc3506 100644 --- a/modules/angular2/src/core/change_detection/proto_record.ts +++ b/modules/angular2/src/core/change_detection/proto_record.ts @@ -1,4 +1,3 @@ -import {List} from 'angular2/src/core/facade/collection'; import {BindingRecord} from './binding_record'; import {DirectiveIndex} from './directive_record'; @@ -23,8 +22,8 @@ export enum RecordType { } export class ProtoRecord { - constructor(public mode: RecordType, public name: string, public funcOrValue, - public args: List, public fixedArgs: List, public contextIndex: number, + constructor(public mode: RecordType, public name: string, public funcOrValue, public args: any[], + public fixedArgs: any[], public contextIndex: number, public directiveIndex: DirectiveIndex, public selfIndex: number, public bindingRecord: BindingRecord, public lastInBinding: boolean, public lastInDirective: boolean, public argumentToPureFunction: boolean, diff --git a/modules/angular2/src/core/compiler/compiler.ts b/modules/angular2/src/core/compiler/compiler.ts index 23d3851acd..fcea65b4e0 100644 --- a/modules/angular2/src/core/compiler/compiler.ts +++ b/modules/angular2/src/core/compiler/compiler.ts @@ -11,7 +11,7 @@ import { isPromise } from 'angular2/src/core/facade/lang'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; -import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; import {DirectiveResolver} from './directive_resolver'; @@ -212,7 +212,7 @@ export class Compiler { return resultPromise; } - private _removeDuplicatedDirectives(directives: List): List { + private _removeDuplicatedDirectives(directives: DirectiveBinding[]): DirectiveBinding[] { var directivesMap: Map = new Map(); directives.forEach((dirBinding) => { directivesMap.set(dirBinding.key.id, dirBinding); }); return MapWrapper.values(directivesMap); @@ -270,7 +270,7 @@ export class Compiler { } private _collectMergeRenderProtoViews(appProtoView: - AppProtoView): List> { + AppProtoView): Array { var result = [appProtoView.render]; for (var i = 0; i < appProtoView.elementBinders.length; i++) { var binder = appProtoView.elementBinders[i]; @@ -330,14 +330,14 @@ export class Compiler { return pipes; } - private _flattenDirectives(view: ViewMetadata): List { + private _flattenDirectives(view: ViewMetadata): Type[] { if (isBlank(view.directives)) return []; var directives = []; this._flattenList(view.directives, directives); return directives; } - private _flattenList(tree: List, out: List>): void { + private _flattenList(tree: any[], out: Array): void { for (var i = 0; i < tree.length; i++) { var item = resolveForwardRef(tree[i]); if (isArray(item)) { diff --git a/modules/angular2/src/core/compiler/element_injector.ts b/modules/angular2/src/core/compiler/element_injector.ts index 313b68092d..99ae9d9162 100644 --- a/modules/angular2/src/core/compiler/element_injector.ts +++ b/modules/angular2/src/core/compiler/element_injector.ts @@ -8,7 +8,7 @@ import { StringWrapper } from 'angular2/src/core/facade/lang'; import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import { Injector, ProtoInjector, @@ -163,7 +163,7 @@ export class TreeNode> { export class DirectiveDependency extends Dependency { constructor(key: Key, optional: boolean, lowerBoundVisibility: Object, - upperBoundVisibility: Object, properties: List, public attributeName: string, + upperBoundVisibility: Object, properties: any[], public attributeName: string, public queryDecorator: QueryMetadata) { super(key, optional, lowerBoundVisibility, upperBoundVisibility, properties); this._verify(); @@ -195,9 +195,9 @@ export class DirectiveDependency extends Dependency { } export class DirectiveBinding extends ResolvedBinding { - constructor(key: Key, factory: Function, dependencies: List, - public resolvedBindings: List, - public resolvedViewBindings: List, + constructor(key: Key, factory: Function, dependencies: Dependency[], + public resolvedBindings: ResolvedBinding[], + public resolvedViewBindings: ResolvedBinding[], public metadata: RenderDirectiveMetadata) { super(key, factory, dependencies); } @@ -210,7 +210,7 @@ export class DirectiveBinding extends ResolvedBinding { get displayName(): string { return this.key.displayName; } - get eventEmitters(): List { + get eventEmitters(): string[] { return isPresent(this.metadata) && isPresent(this.metadata.events) ? this.metadata.events : []; } @@ -294,7 +294,7 @@ export class HostActionAccessor { subscribe(view: viewModule.AppView, boundElementIndex: number, directive: Object): Object { var eventEmitter = this.getter(directive); - return ObservableWrapper.subscribe>( + return ObservableWrapper.subscribe( eventEmitter, actionArgs => view.invokeElementMethod(boundElementIndex, this.methodName, actionArgs)); } @@ -313,10 +313,10 @@ function _createEventEmitterAccessors(bwv: BindingWithVisibility): EventEmitterA export class ProtoElementInjector { view: viewModule.AppView; attributes: Map; - eventEmitterAccessors: List>; + eventEmitterAccessors: EventEmitterAccessor[][]; protoInjector: ProtoInjector; - static create(parent: ProtoElementInjector, index: number, bindings: List, + static create(parent: ProtoElementInjector, index: number, bindings: ResolvedBinding[], firstBindingIsComponent: boolean, distanceToParent: number, directiveVariableBindings: Map): ProtoElementInjector { var bd = []; @@ -331,7 +331,7 @@ export class ProtoElementInjector { directiveVariableBindings); } - private static _createDirectiveBindingWithVisibility(dirBindings: List, + private static _createDirectiveBindingWithVisibility(dirBindings: ResolvedBinding[], bd: BindingWithVisibility[], firstBindingIsComponent: boolean) { ListWrapper.forEach(dirBindings, dirBinding => { @@ -340,7 +340,7 @@ export class ProtoElementInjector { }); } - private static _createBindingsWithVisibility(dirBindings: List, + private static _createBindingsWithVisibility(dirBindings: ResolvedBinding[], bd: BindingWithVisibility[], firstBindingIsComponent: boolean) { ListWrapper.forEach(dirBindings, dirBinding => { @@ -358,7 +358,7 @@ export class ProtoElementInjector { isComponent ? Visibility.PublicAndPrivate : Visibility.Public); } - private static _createViewBindingsWithVisibility(bindings: List, + private static _createViewBindingsWithVisibility(bindings: ResolvedBinding[], bd: BindingWithVisibility[]) { var db = bindings[0]; ListWrapper.forEach(db.resolvedViewBindings, @@ -540,9 +540,7 @@ export class ElementInjector extends TreeNode implements Depend hasDirective(type: Type): boolean { return isPresent(this._injector.getOptional(type)); } - getEventEmitterAccessors(): List> { - return this._proto.eventEmitterAccessors; - } + getEventEmitterAccessors(): EventEmitterAccessor[][] { return this._proto.eventEmitterAccessors; } getDirectiveVariableBindings(): Map { return this._proto.directiveVariableBindings; @@ -628,7 +626,7 @@ export class ElementInjector extends TreeNode implements Depend } } - _buildQueriesForDeps(deps: List): void { + _buildQueriesForDeps(deps: DirectiveDependency[]): void { for (var i = 0; i < deps.length; i++) { var dep = deps[i]; if (isPresent(dep.queryDecorator)) { @@ -948,34 +946,34 @@ class ElementInjectorInlineStrategy implements _ElementInjectorStrategy { var p = this.injectorStrategy.protoStrategy; if (p.binding0 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding0.dependencies); + this._ei._buildQueriesForDeps(p.binding0.dependencies); } if (p.binding1 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding1.dependencies); + this._ei._buildQueriesForDeps(p.binding1.dependencies); } if (p.binding2 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding2.dependencies); + this._ei._buildQueriesForDeps(p.binding2.dependencies); } if (p.binding3 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding3.dependencies); + this._ei._buildQueriesForDeps(p.binding3.dependencies); } if (p.binding4 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding4.dependencies); + this._ei._buildQueriesForDeps(p.binding4.dependencies); } if (p.binding5 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding5.dependencies); + this._ei._buildQueriesForDeps(p.binding5.dependencies); } if (p.binding6 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding6.dependencies); + this._ei._buildQueriesForDeps(p.binding6.dependencies); } if (p.binding7 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding7.dependencies); + this._ei._buildQueriesForDeps(p.binding7.dependencies); } if (p.binding8 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding8.dependencies); + this._ei._buildQueriesForDeps(p.binding8.dependencies); } if (p.binding9 instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.binding9.dependencies); + this._ei._buildQueriesForDeps(p.binding9.dependencies); } } @@ -1081,7 +1079,7 @@ class ElementInjectorDynamicStrategy implements _ElementInjectorStrategy { for (var i = 0; i < p.bindings.length; i++) { if (p.bindings[i] instanceof DirectiveBinding) { - this._ei._buildQueriesForDeps(>p.bindings[i].dependencies); + this._ei._buildQueriesForDeps(p.bindings[i].dependencies); } } } @@ -1153,7 +1151,7 @@ export class QueryRef { } } - private _aggregateVariableBindings(inj: ElementInjector, aggregator: List): void { + private _aggregateVariableBindings(inj: ElementInjector, aggregator: any[]): void { var vb = this.query.varBindings; for (var i = 0; i < vb.length; ++i) { if (inj.hasVariableBinding(vb[i])) { @@ -1162,7 +1160,7 @@ export class QueryRef { } } - private _aggregateDirective(inj: ElementInjector, aggregator: List): void { + private _aggregateDirective(inj: ElementInjector, aggregator: any[]): void { inj.addDirectivesMatchingQuery(this.query, aggregator); } } diff --git a/modules/angular2/src/core/compiler/proto_view_factory.ts b/modules/angular2/src/core/compiler/proto_view_factory.ts index aaa9db2ccb..a193190c83 100644 --- a/modules/angular2/src/core/compiler/proto_view_factory.ts +++ b/modules/angular2/src/core/compiler/proto_view_factory.ts @@ -1,6 +1,6 @@ import {Injectable} from 'angular2/di'; -import {List, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import { StringWrapper, isPresent, @@ -40,7 +40,7 @@ import {ProtoElementInjector, DirectiveBinding} from './element_injector'; export class BindingRecordsCreator { _directiveRecordsMap: Map = new Map(); - getEventBindingRecords(elementBinders: List, + getEventBindingRecords(elementBinders: RenderElementBinder[], allDirectiveMetadatas: RenderDirectiveMetadata[]): BindingRecord[] { var res = []; for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; @@ -75,10 +75,8 @@ export class BindingRecordsCreator { } } - getPropertyBindingRecords(textBindings: List, - elementBinders: List, - allDirectiveMetadatas: - List): List { + getPropertyBindingRecords(textBindings: ASTWithSource[], elementBinders: RenderElementBinder[], + allDirectiveMetadatas: RenderDirectiveMetadata[]): BindingRecord[] { var bindings = []; this._createTextNodeRecords(bindings, textBindings); @@ -93,8 +91,8 @@ export class BindingRecordsCreator { return bindings; } - getDirectiveRecords(elementBinders: List, - allDirectiveMetadatas: List): List { + getDirectiveRecords(elementBinders: RenderElementBinder[], + allDirectiveMetadatas: RenderDirectiveMetadata[]): DirectiveRecord[] { var directiveRecords = []; for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { @@ -108,13 +106,13 @@ export class BindingRecordsCreator { return directiveRecords; } - _createTextNodeRecords(bindings: List, textBindings: List) { + _createTextNodeRecords(bindings: BindingRecord[], textBindings: ASTWithSource[]) { for (var i = 0; i < textBindings.length; i++) { bindings.push(BindingRecord.createForTextNode(textBindings[i], i)); } } - _createElementPropertyRecords(bindings: List, boundElementIndex: number, + _createElementPropertyRecords(bindings: BindingRecord[], boundElementIndex: number, renderElementBinder: RenderElementBinder) { ListWrapper.forEach(renderElementBinder.propertyBindings, (binding) => { if (binding.type === PropertyBindingType.PROPERTY) { @@ -133,9 +131,9 @@ export class BindingRecordsCreator { }); } - _createDirectiveRecords(bindings: List, boundElementIndex: number, - directiveBinders: List, - allDirectiveMetadatas: List) { + _createDirectiveRecords(bindings: BindingRecord[], boundElementIndex: number, + directiveBinders: DirectiveBinder[], + allDirectiveMetadatas: RenderDirectiveMetadata[]) { for (var i = 0; i < directiveBinders.length; i++) { var directiveBinder = directiveBinders[i]; var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; @@ -214,7 +212,7 @@ export class ProtoViewFactory { constructor(public _changeDetection: ChangeDetection) {} createAppProtoViews(hostComponentBinding: DirectiveBinding, rootRenderProtoView: ProtoViewDto, - allDirectives: List, pipes: PipeBinding[]): AppProtoView[] { + allDirectives: DirectiveBinding[], pipes: PipeBinding[]): AppProtoView[] { var allRenderDirectiveMetadata = ListWrapper.map(allDirectives, directiveBinding => directiveBinding.metadata); var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); @@ -264,8 +262,8 @@ export class ProtoViewFactory { */ export function getChangeDetectorDefinitions( hostComponentMetadata: RenderDirectiveMetadata, rootRenderProtoView: ProtoViewDto, - allRenderDirectiveMetadata: List, genConfig: ChangeDetectorGenConfig): - List { + allRenderDirectiveMetadata: RenderDirectiveMetadata[], genConfig: ChangeDetectorGenConfig): + ChangeDetectorDefinition[] { var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, @@ -275,7 +273,7 @@ export function getChangeDetectorDefinitions( function _collectNestedProtoViews( renderProtoView: ProtoViewDto, parentIndex: number = null, boundElementIndex = null, - result: List = null): List { + result: RenderProtoViewWithIndex[] = null): RenderProtoViewWithIndex[] { if (isBlank(result)) { result = []; } @@ -295,10 +293,9 @@ function _collectNestedProtoViews( } function _getChangeDetectorDefinitions( - hostComponentMetadata: RenderDirectiveMetadata, - nestedPvsWithIndex: List, nestedPvVariableNames: List>, - allRenderDirectiveMetadata: List, genConfig: ChangeDetectorGenConfig): - List { + hostComponentMetadata: RenderDirectiveMetadata, nestedPvsWithIndex: RenderProtoViewWithIndex[], + nestedPvVariableNames: string[][], allRenderDirectiveMetadata: RenderDirectiveMetadata[], + genConfig: ChangeDetectorGenConfig): ChangeDetectorDefinition[] { return ListWrapper.map(nestedPvsWithIndex, (pvWithIndex) => { var elementBinders = pvWithIndex.renderProtoView.elementBinders; var bindingRecordsCreator = new BindingRecordsCreator(); @@ -320,8 +317,7 @@ function _getChangeDetectorDefinitions( } function _getChangeDetectorDefinitionIds(hostComponentMetadata: RenderDirectiveMetadata, - nestedPvsWithIndex: List): - string[] { + nestedPvsWithIndex: RenderProtoViewWithIndex[]): string[] { return nestedPvsWithIndex.map(pvWithIndex => _protoViewId(hostComponentMetadata, pvWithIndex)); } @@ -340,8 +336,8 @@ function _protoViewId(hostComponentMetadata: RenderDirectiveMetadata, function _createAppProtoView( renderProtoView: ProtoViewDto, protoChangeDetector: ProtoChangeDetector, - variableBindings: Map, allDirectives: List, - pipes: PipeBinding[]): AppProtoView { + variableBindings: Map, allDirectives: DirectiveBinding[], pipes: PipeBinding[]): + AppProtoView { var elementBinders = renderProtoView.elementBinders; // Embedded ProtoViews that contain `` will be merged into their parents and use // a RenderFragmentRef. I.e. renderProtoView.transitiveNgContentCount > 0. @@ -354,8 +350,8 @@ function _createAppProtoView( return protoView; } -function _collectNestedProtoViewsVariableBindings( - nestedPvsWithIndex: List): List> { +function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex: RenderProtoViewWithIndex[]): + Array> { return ListWrapper.map(nestedPvsWithIndex, (pvWithIndex) => { return _createVariableBindings(pvWithIndex.renderProtoView); }); @@ -368,8 +364,8 @@ function _createVariableBindings(renderProtoView): Map { return variableBindings; } -function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex: List): - List> { +function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex: RenderProtoViewWithIndex[]): + string[][] { var nestedPvVariableNames = ListWrapper.createFixedSize(nestedPvsWithIndex.length); ListWrapper.forEach(nestedPvsWithIndex, (pvWithIndex) => { var parentVariableNames = @@ -380,9 +376,8 @@ function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex: List, renderProtoView): List { - var res = - isBlank(parentVariableNames) ? >[] : ListWrapper.clone(parentVariableNames); +function _createVariableNames(parentVariableNames: string[], renderProtoView): string[] { + var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames); MapWrapper.forEach(renderProtoView.variableBindings, (mappedName, varName) => { res.push(mappedName); }); ListWrapper.forEach(renderProtoView.elementBinders, binder => { @@ -392,7 +387,7 @@ function _createVariableNames(parentVariableNames: List, renderProtoView return res; } -export function createVariableLocations(elementBinders: List): +export function createVariableLocations(elementBinders: RenderElementBinder[]): Map { var variableLocations = new Map(); for (var i = 0; i < elementBinders.length; i++) { @@ -486,7 +481,7 @@ function _createElementBinder(protoView: AppProtoView, boundElementIndex, render } export function createDirectiveVariableBindings(renderElementBinder: RenderElementBinder, - directiveBindings: List): + directiveBindings: DirectiveBinding[]): Map { var directiveVariableBindings = new Map(); MapWrapper.forEach(renderElementBinder.variableBindings, (templateName, exportAs) => { diff --git a/modules/angular2/src/core/compiler/query_list.ts b/modules/angular2/src/core/compiler/query_list.ts index 1f862ddd6e..659a5f66fe 100644 --- a/modules/angular2/src/core/compiler/query_list.ts +++ b/modules/angular2/src/core/compiler/query_list.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; /** * An iterable and observable live list of components in the DOM. @@ -72,11 +72,11 @@ import {List, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection * ``` */ export class QueryList { - protected _results: List < T >= []; - protected _callbacks: List < () => void >= []; + protected _results: Array < T >= []; + protected _callbacks: Array < () => void >= []; protected _dirty: boolean = false; - reset(newList: List): void { + reset(newList: T[]): void { this._results = newList; this._dirty = true; } diff --git a/modules/angular2/src/core/compiler/view.ts b/modules/angular2/src/core/compiler/view.ts index 048874e7cc..d50cf54591 100644 --- a/modules/angular2/src/core/compiler/view.ts +++ b/modules/angular2/src/core/compiler/view.ts @@ -3,7 +3,6 @@ import { MapWrapper, Map, StringMapWrapper, - List, StringMap } from 'angular2/src/core/facade/collection'; import { @@ -74,7 +73,7 @@ function inverseIndexMapping(input: number[], resultLength: number): number[] { export class AppViewContainer { // The order in this list matches the DOM order. - views: List = []; + views: AppView[] = []; } /** @@ -85,26 +84,26 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher { // AppViews that have been merged in depth first order. // This list is shared between all merged views. Use this.elementOffset to get the local // entries. - views: List = null; + views: AppView[] = null; // root elementInjectors of this AppView // This list is local to this AppView and not shared with other Views. - rootElementInjectors: List; + rootElementInjectors: ElementInjector[]; // ElementInjectors of all AppViews in views grouped by view. // This list is shared between all merged views. Use this.elementOffset to get the local // entries. - elementInjectors: List = null; + elementInjectors: ElementInjector[] = null; // ViewContainers of all AppViews in views grouped by view. // This list is shared between all merged views. Use this.elementOffset to get the local // entries. - viewContainers: List = null; + viewContainers: AppViewContainer[] = null; // PreBuiltObjects of all AppViews in views grouped by view. // This list is shared between all merged views. Use this.elementOffset to get the local // entries. - preBuiltObjects: List = null; + preBuiltObjects: PreBuiltObjects[] = null; // ElementRef of all AppViews in views grouped by view. // This list is shared between all merged views. Use this.elementOffset to get the local // entries. - elementRefs: List; + elementRefs: ElementRef[]; ref: ViewRef; changeDetector: ChangeDetector = null; @@ -134,10 +133,9 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher { this.locals = new Locals(null, MapWrapper.clone(protoLocals)); // TODO optimize this } - init(changeDetector: ChangeDetector, elementInjectors: List, - rootElementInjectors: List, preBuiltObjects: List, - views: List, elementRefs: List, - viewContainers: List) { + init(changeDetector: ChangeDetector, elementInjectors: ElementInjector[], + rootElementInjectors: ElementInjector[], preBuiltObjects: PreBuiltObjects[], + views: AppView[], elementRefs: ElementRef[], viewContainers: AppViewContainer[]) { this.changeDetector = changeDetector; this.elementInjectors = elementInjectors; this.rootElementInjectors = rootElementInjectors; @@ -260,7 +258,7 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher { return isPresent(childView) ? childView.changeDetector : null; } - invokeElementMethod(elementIndex: number, methodName: string, args: List) { + invokeElementMethod(elementIndex: number, methodName: string, args: any[]) { this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); } @@ -325,7 +323,7 @@ class EventEvaluationError extends BaseException { * */ export class AppProtoView { - elementBinders: List = []; + elementBinders: ElementBinder[] = []; protoLocals: Map = new Map(); mergeMapping: AppProtoViewMergeMapping; ref: ProtoViewRef; diff --git a/modules/angular2/src/core/compiler/view_container_ref.ts b/modules/angular2/src/core/compiler/view_container_ref.ts index a11a4babf1..8a70ac69a3 100644 --- a/modules/angular2/src/core/compiler/view_container_ref.ts +++ b/modules/angular2/src/core/compiler/view_container_ref.ts @@ -1,4 +1,4 @@ -import {ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {ResolvedBinding} from 'angular2/di'; import {isPresent, isBlank} from 'angular2/src/core/facade/lang'; @@ -22,7 +22,7 @@ export class ViewContainerRef { */ constructor(public viewManager: avmModule.AppViewManager, public element: ElementRef) {} - private _getViews(): List { + private _getViews(): Array { var vc = internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; return isPresent(vc) ? vc.views : []; } diff --git a/modules/angular2/src/core/compiler/view_manager_utils.ts b/modules/angular2/src/core/compiler/view_manager_utils.ts index b7576f7503..d9f9358bd7 100644 --- a/modules/angular2/src/core/compiler/view_manager_utils.ts +++ b/modules/angular2/src/core/compiler/view_manager_utils.ts @@ -1,11 +1,5 @@ import {Injector, Binding, Injectable, ResolvedBinding} from 'angular2/di'; -import { - ListWrapper, - MapWrapper, - Map, - StringMapWrapper, - List -} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, Map, StringMapWrapper} from 'angular2/src/core/facade/collection'; import * as eli from './element_injector'; import {isPresent, isBlank, BaseException} from 'angular2/src/core/facade/lang'; import * as viewModule from './view'; diff --git a/modules/angular2/src/core/compiler/view_pool.ts b/modules/angular2/src/core/compiler/view_pool.ts index 229891562c..e37994bddc 100644 --- a/modules/angular2/src/core/compiler/view_pool.ts +++ b/modules/angular2/src/core/compiler/view_pool.ts @@ -1,6 +1,6 @@ import {Inject, Injectable, OpaqueToken} from 'angular2/di'; -import {ListWrapper, MapWrapper, Map, List} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, Map} from 'angular2/src/core/facade/collection'; import {isPresent, isBlank, CONST_EXPR} from 'angular2/src/core/facade/lang'; import * as viewModule from './view'; @@ -10,7 +10,7 @@ export const APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.vi @Injectable() export class AppViewPool { _poolCapacityPerProtoView: number; - _pooledViewsPerProtoView: Map> = new Map(); + _pooledViewsPerProtoView: Map> = new Map(); constructor(@Inject(APP_VIEW_POOL_CAPACITY) poolCapacityPerProtoView) { this._poolCapacityPerProtoView = poolCapacityPerProtoView; diff --git a/modules/angular2/src/core/compiler/view_resolver.ts b/modules/angular2/src/core/compiler/view_resolver.ts index 9f3673c3a3..6a829e7def 100644 --- a/modules/angular2/src/core/compiler/view_resolver.ts +++ b/modules/angular2/src/core/compiler/view_resolver.ts @@ -2,7 +2,7 @@ import {Injectable} from 'angular2/di'; import {ViewMetadata} from '../metadata/view'; import {Type, stringify, isBlank, BaseException} from 'angular2/src/core/facade/lang'; -import {Map, MapWrapper, List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {Map, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {reflector} from 'angular2/src/core/reflection/reflection'; diff --git a/modules/angular2/src/core/debug/debug_element.ts b/modules/angular2/src/core/debug/debug_element.ts index 1ac528529a..39a6787b5e 100644 --- a/modules/angular2/src/core/debug/debug_element.ts +++ b/modules/angular2/src/core/debug/debug_element.ts @@ -1,5 +1,5 @@ import {Type, isPresent, BaseException, isBlank} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, MapWrapper, Predicate} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, Predicate} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; @@ -42,9 +42,9 @@ export class DebugElement { /** * Get child DebugElements from within the Light DOM. * - * @return {List} + * @return {DebugElement[]} */ - get children(): List { + get children(): DebugElement[] { return this._getChildElements(this._parentView, this._boundElementIndex); } @@ -52,9 +52,9 @@ export class DebugElement { * Get the root DebugElement children of a component. Returns an empty * list if the current DebugElement is not a component root. * - * @return {List} + * @return {DebugElement[]} */ - get componentViewChildren(): List { + get componentViewChildren(): DebugElement[] { var shadowView = this._parentView.getNestedView(this._boundElementIndex); if (!isPresent(shadowView)) { @@ -106,15 +106,15 @@ export class DebugElement { * @param {Function: boolean} predicate * @param {Scope} scope * - * @return {List} + * @return {DebugElement[]} */ - queryAll(predicate: Predicate, scope: Function = Scope.all): List { + queryAll(predicate: Predicate, scope: Function = Scope.all): DebugElement[] { var elementsInScope = scope(this); return ListWrapper.filter(elementsInScope, predicate); } - _getChildElements(view: AppView, parentBoundElementIndex: number): List { + _getChildElements(view: AppView, parentBoundElementIndex: number): DebugElement[] { var els = []; var parentElementBinder = null; if (isPresent(parentBoundElementIndex)) { @@ -128,7 +128,7 @@ export class DebugElement { var views = view.viewContainers[view.elementOffset + i]; if (isPresent(views)) { ListWrapper.forEach(views.views, (nextView) => { - els = ListWrapper.concat(els, this._getChildElements(nextView, null)); + els = els.concat(this._getChildElements(nextView, null)); }); } } @@ -141,38 +141,38 @@ export function inspectElement(elementRef: ElementRef): DebugElement { return DebugElement.create(elementRef); } -export function asNativeElements(arr: List): List { +export function asNativeElements(arr: DebugElement[]): any[] { return arr.map((debugEl) => debugEl.nativeElement); } export class Scope { - static all(debugElement: DebugElement): List { + static all(debugElement: DebugElement): DebugElement[] { var scope = []; scope.push(debugElement); ListWrapper.forEach(debugElement.children, - (child) => { scope = ListWrapper.concat(scope, Scope.all(child)); }); + (child) => { scope = scope.concat(Scope.all(child)); }); ListWrapper.forEach(debugElement.componentViewChildren, - (child) => { scope = ListWrapper.concat(scope, Scope.all(child)); }); + (child) => { scope = scope.concat(Scope.all(child)); }); return scope; } - static light(debugElement: DebugElement): List { + static light(debugElement: DebugElement): DebugElement[] { var scope = []; ListWrapper.forEach(debugElement.children, (child) => { scope.push(child); - scope = ListWrapper.concat(scope, Scope.light(child)); + scope = scope.concat(Scope.light(child)); }); return scope; } - static view(debugElement: DebugElement): List { + static view(debugElement: DebugElement): DebugElement[] { var scope = []; ListWrapper.forEach(debugElement.componentViewChildren, (child) => { scope.push(child); - scope = ListWrapper.concat(scope, Scope.light(child)); + scope = scope.concat(Scope.light(child)); }); return scope; } diff --git a/modules/angular2/src/core/debug/debug_element_view_listener.ts b/modules/angular2/src/core/debug/debug_element_view_listener.ts index 1f3e63078a..6bdbc38168 100644 --- a/modules/angular2/src/core/debug/debug_element_view_listener.ts +++ b/modules/angular2/src/core/debug/debug_element_view_listener.ts @@ -1,5 +1,5 @@ import {CONST_EXPR, isPresent, NumberWrapper, StringWrapper} from 'angular2/src/core/facade/lang'; -import {MapWrapper, Map, ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {MapWrapper, Map, ListWrapper} from 'angular2/src/core/facade/collection'; import {Injectable, bind, Binding} from 'angular2/di'; import {AppViewListener} from 'angular2/src/core/compiler/view_listener'; import {AppView} from 'angular2/src/core/compiler/view'; @@ -18,13 +18,13 @@ var _allViewsById = new Map(); var _nextId = 0; -function _setElementId(element, indices: List) { +function _setElementId(element, indices: number[]) { if (isPresent(element)) { DOM.setData(element, NG_ID_PROPERTY, ListWrapper.join(indices, NG_ID_SEPARATOR)); } } -function _getElementId(element): List { +function _getElementId(element): number[] { var elId = DOM.getData(element, NG_ID_PROPERTY); if (isPresent(elId)) { return ListWrapper.map(elId.split(NG_ID_SEPARATOR), diff --git a/modules/angular2/src/core/di/binding.ts b/modules/angular2/src/core/di/binding.ts index aa943708fe..2f21baef43 100644 --- a/modules/angular2/src/core/di/binding.ts +++ b/modules/angular2/src/core/di/binding.ts @@ -8,7 +8,7 @@ import { stringify, isArray } from 'angular2/src/core/facade/lang'; -import {List, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; +import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {reflector} from 'angular2/src/core/reflection/reflection'; import {Key} from './key'; import { @@ -28,7 +28,7 @@ import {resolveForwardRef} from './forward_ref'; */ export class Dependency { constructor(public key: Key, public optional: boolean, public lowerBoundVisibility: any, - public upperBoundVisibility: any, public properties: List) {} + public upperBoundVisibility: any, public properties: any[]) {} static fromKey(key: Key): Dependency { return new Dependency(key, false, null, null, []); } } @@ -174,12 +174,12 @@ export class Binding { * expect(injector.get(String)).toEqual('Value: 3'); * ``` */ - dependencies: List; + dependencies: any[]; constructor( token, {toClass, toValue, toAlias, toFactory, deps}: - {toClass?: Type, toValue?: any, toAlias?: any, toFactory?: Function, deps?: List}) { + {toClass?: Type, toValue?: any, toAlias?: any, toFactory?: Function, deps?: any[]}) { this.token = token; this.toClass = toClass; this.toValue = toValue; @@ -238,7 +238,7 @@ export class ResolvedBinding { /** * Arguments (dependencies) to the `factory` function. */ - public dependencies: List) {} + public dependencies: Dependency[]) {} } /** @@ -365,32 +365,30 @@ export class BindingBuilder { * expect(injector.get(String)).toEqual('Value: 3'); * ``` */ - toFactory(factoryFunction: Function, dependencies?: List): Binding { + toFactory(factoryFunction: Function, dependencies?: any[]): Binding { return new Binding(this.token, {toFactory: factoryFunction, deps: dependencies}); } } -function _constructDependencies(factoryFunction: Function, dependencies: List): - List { +function _constructDependencies(factoryFunction: Function, dependencies: any[]): Dependency[] { if (isBlank(dependencies)) { return _dependenciesFor(factoryFunction); } else { - var params: List> = ListWrapper.map(dependencies, (t) => [t]); + var params: any[][] = ListWrapper.map(dependencies, (t) => [t]); return ListWrapper.map(dependencies, (t) => _extractToken(factoryFunction, t, params)); } } -function _dependenciesFor(typeOrFunc): List { +function _dependenciesFor(typeOrFunc): Dependency[] { var params = reflector.parameters(typeOrFunc); if (isBlank(params)) return []; if (ListWrapper.any(params, (p) => isBlank(p))) { throw new NoAnnotationError(typeOrFunc, params); } - return ListWrapper.map(params, (p: List) => _extractToken(typeOrFunc, p, params)); + return ListWrapper.map(params, (p: any[]) => _extractToken(typeOrFunc, p, params)); } -function _extractToken(typeOrFunc, metadata /*List | any*/, params: List>): - Dependency { +function _extractToken(typeOrFunc, metadata /*any[] | any*/, params: any[][]): Dependency { var depProps = []; var token = null; var optional = false; diff --git a/modules/angular2/src/core/di/exceptions.ts b/modules/angular2/src/core/di/exceptions.ts index dc25df252d..1de301aff5 100644 --- a/modules/angular2/src/core/di/exceptions.ts +++ b/modules/angular2/src/core/di/exceptions.ts @@ -1,9 +1,9 @@ -import {ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {stringify, BaseException, isBlank} from 'angular2/src/core/facade/lang'; import {Key} from './key'; import {Injector} from './injector'; -function findFirstClosedCycle(keys: List): List { +function findFirstClosedCycle(keys: any[]): any[] { var res = []; for (var i = 0; i < keys.length; ++i) { if (ListWrapper.contains(res, keys[i])) { @@ -16,7 +16,7 @@ function findFirstClosedCycle(keys: List): List { return res; } -function constructResolvingPath(keys: List): string { +function constructResolvingPath(keys: any[]): string { if (keys.length > 1) { var reversed = findFirstClosedCycle(ListWrapper.reversed(keys)); var tokenStrs = ListWrapper.map(reversed, (k) => stringify(k.token)); @@ -33,8 +33,8 @@ function constructResolvingPath(keys: List): string { export class AbstractBindingError extends BaseException { name: string; message: string; - keys: List; - injectors: List; + keys: Key[]; + injectors: Injector[]; constructResolvingMessage: Function; constructor(injector: Injector, key: Key, constructResolvingMessage: Function, originalException?, @@ -63,7 +63,7 @@ export class AbstractBindingError extends BaseException { */ export class NoBindingError extends AbstractBindingError { constructor(injector: Injector, key: Key) { - super(injector, key, function(keys: List) { + super(injector, key, function(keys: any[]) { var first = stringify(ListWrapper.first(keys).token); return `No provider for ${first}!${constructResolvingPath(keys)}`; }); @@ -88,7 +88,7 @@ export class NoBindingError extends AbstractBindingError { */ export class CyclicDependencyError extends AbstractBindingError { constructor(injector: Injector, key: Key) { - super(injector, key, function(keys: List) { + super(injector, key, function(keys: any[]) { return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`; }); } @@ -103,7 +103,7 @@ export class CyclicDependencyError extends AbstractBindingError { export class InstantiationError extends AbstractBindingError { causeKey: Key; constructor(injector: Injector, originalException, originalStack, key: Key) { - super(injector, key, function(keys: List) { + super(injector, key, function(keys: any[]) { var first = stringify(ListWrapper.first(keys).token); return `Error during instantiation of ${first}!${constructResolvingPath(keys)}.`; }, originalException, originalStack); @@ -136,7 +136,7 @@ export class InvalidBindingError extends BaseException { export class NoAnnotationError extends BaseException { name: string; message: string; - constructor(typeOrFunc, params: List>) { + constructor(typeOrFunc, params: any[][]) { super(); var signature = []; for (var i = 0, ii = params.length; i < ii; i++) { diff --git a/modules/angular2/src/core/di/injector.ts b/modules/angular2/src/core/di/injector.ts index f4a325846c..bcb19db768 100644 --- a/modules/angular2/src/core/di/injector.ts +++ b/modules/angular2/src/core/di/injector.ts @@ -1,4 +1,4 @@ -import {Map, List, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; +import {Map, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {ResolvedBinding, Binding, Dependency, BindingBuilder, bind} from './binding'; import { AbstractBindingError, @@ -427,7 +427,7 @@ export class Injector { *such as * `fromResolvedBindings` and `createChildFromResolved`. */ - static resolve(bindings: List>): List { + static resolve(bindings: Array): ResolvedBinding[] { var resolvedBindings = _resolveBindings(bindings); var flatten = _flattenBindings(resolvedBindings, new Map()); return _createListOfBindings(flatten); @@ -446,7 +446,7 @@ export class Injector { * bindings. * @param `depProvider` */ - static resolveAndCreate(bindings: List>, + static resolveAndCreate(bindings: Array, depProvider: DependencyProvider = null): Injector { var resolvedBindings = Injector.resolve(bindings); return Injector.fromResolvedBindings(resolvedBindings, depProvider); @@ -460,7 +460,7 @@ export class Injector { * {@link Injector}. * @param `depProvider` */ - static fromResolvedBindings(bindings: List, + static fromResolvedBindings(bindings: ResolvedBinding[], depProvider: DependencyProvider = null): Injector { var bd = bindings.map(b => new BindingWithVisibility(b, Visibility.Public)); var proto = new ProtoInjector(bd); @@ -537,7 +537,7 @@ export class Injector { * recursive list of more bindings. * @param `depProvider` */ - resolveAndCreateChild(bindings: List>, + resolveAndCreateChild(bindings: Array, depProvider: DependencyProvider = null): Injector { var resovledBindings = Injector.resolve(bindings); return this.createChildFromResolved(resovledBindings, depProvider); @@ -551,7 +551,7 @@ export class Injector { * @param `depProvider` * @returns a new child {@link Injector}. */ - createChildFromResolved(bindings: List, + createChildFromResolved(bindings: ResolvedBinding[], depProvider: DependencyProvider = null): Injector { var bd = bindings.map(b => new BindingWithVisibility(b, Visibility.Public)); var proto = new ProtoInjector(bd); @@ -801,7 +801,7 @@ export class Injector { var INJECTOR_KEY = Key.get(Injector); -function _resolveBindings(bindings: List>): List { +function _resolveBindings(bindings: Array): ResolvedBinding[] { var resolvedList = ListWrapper.createFixedSize(bindings.length); for (var i = 0; i < bindings.length; i++) { var unresolved = resolveForwardRef(bindings[i]); @@ -812,7 +812,7 @@ function _resolveBindings(bindings: List>): List>): List): - List { +function _createListOfBindings(flattenedBindings: Map): ResolvedBinding[] { return MapWrapper.values(flattenedBindings); } -function _flattenBindings(bindings: List>, +function _flattenBindings(bindings: Array, res: Map): Map { ListWrapper.forEach(bindings, function(b) { if (b instanceof ResolvedBinding) { res.set(b.key.id, b); - } else if (b instanceof List) { + } else if (b instanceof Array) { _flattenBindings(b, res); } }); diff --git a/modules/angular2/src/core/directives/ng_for.ts b/modules/angular2/src/core/directives/ng_for.ts index fe250ddb47..5b1ad6ee89 100644 --- a/modules/angular2/src/core/directives/ng_for.ts +++ b/modules/angular2/src/core/directives/ng_for.ts @@ -83,8 +83,7 @@ export class NgFor { view.setLocal('index', record.currentIndex); } - static bulkRemove(tuples: List, - viewContainer: ViewContainerRef): List { + static bulkRemove(tuples: RecordViewTuple[], viewContainer: ViewContainerRef): RecordViewTuple[] { tuples.sort((a, b) => a.record.previousIndex - b.record.previousIndex); var movedTuples = []; for (var i = tuples.length - 1; i >= 0; i--) { @@ -100,8 +99,8 @@ export class NgFor { return movedTuples; } - static bulkInsert(tuples: List, viewContainer: ViewContainerRef, - templateRef: TemplateRef): List { + static bulkInsert(tuples: RecordViewTuple[], viewContainer: ViewContainerRef, + templateRef: TemplateRef): RecordViewTuple[] { tuples.sort((a, b) => a.record.currentIndex - b.record.currentIndex); for (var i = 0; i < tuples.length; i++) { var tuple = tuples[i]; diff --git a/modules/angular2/src/core/directives/ng_switch.ts b/modules/angular2/src/core/directives/ng_switch.ts index 031fa0b8f7..3bdae00c8a 100644 --- a/modules/angular2/src/core/directives/ng_switch.ts +++ b/modules/angular2/src/core/directives/ng_switch.ts @@ -2,7 +2,7 @@ import {Directive} from 'angular2/metadata'; import {Host} from 'angular2/di'; import {ViewContainerRef, TemplateRef} from 'angular2/core'; import {isPresent, isBlank, normalizeBlank, CONST_EXPR} from 'angular2/src/core/facade/lang'; -import {ListWrapper, List, Map} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map} from 'angular2/src/core/facade/collection'; const _WHEN_DEFAULT = CONST_EXPR(new Object()); @@ -43,8 +43,8 @@ export class SwitchView { export class NgSwitch { private _switchValue: any; private _useDefault: boolean = false; - private _valueViews: Map> = new Map(); - private _activeViews: List = []; + private _valueViews: Map = new Map(); + private _activeViews: SwitchView[] = []; set ngSwitch(value) { // Empty the currently active ViewContainers @@ -93,7 +93,7 @@ export class NgSwitch { this._activeViews = []; } - _activateViews(views: List): void { + _activateViews(views: SwitchView[]): void { // TODO(vicb): assert(this._activeViews.length === 0); if (isPresent(views)) { for (var i = 0; i < views.length; i++) { diff --git a/modules/angular2/src/core/dom/browser_adapter.ts b/modules/angular2/src/core/dom/browser_adapter.ts index 9187c405eb..9854291e69 100644 --- a/modules/angular2/src/core/dom/browser_adapter.ts +++ b/modules/angular2/src/core/dom/browser_adapter.ts @@ -1,4 +1,4 @@ -import {List, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; +import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {isBlank, isPresent, global, setValueOnPath} from 'angular2/src/core/facade/lang'; import {setRootDomAdapter} from './dom_adapter'; import {GenericBrowserDomAdapter} from './generic_browser_adapter'; @@ -59,7 +59,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { hasProperty(element, name: string): boolean { return name in element; } setProperty(el: /*element*/ any, name: string, value: any) { el[name] = value; } getProperty(el: /*element*/ any, name: string): any { return el[name]; } - invoke(el: /*element*/ any, methodName: string, args: List): any { + invoke(el: /*element*/ any, methodName: string, args: any[]): any { el[methodName].apply(el, args); } @@ -93,7 +93,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { query(selector: string): any { return document.querySelector(selector); } querySelector(el, selector: string): HTMLElement { return el.querySelector(selector); } - querySelectorAll(el, selector: string): List { return el.querySelectorAll(selector); } + querySelectorAll(el, selector: string): any[] { return el.querySelectorAll(selector); } on(el, evt, listener) { el.addEventListener(evt, listener, false); } onAndCancel(el, evt, listener): Function { el.addEventListener(evt, listener, false); @@ -134,8 +134,8 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { firstChild(el): Node { return el.firstChild; } nextSibling(el): Node { return el.nextSibling; } parentElement(el): Node { return el.parentNode; } - childNodes(el): List { return el.childNodes; } - childNodesAsList(el): List { + childNodes(el): Node[] { return el.childNodes; } + childNodesAsList(el): any[] { var childNodes = el.childNodes; var res = ListWrapper.createFixedSize(childNodes.length); for (var i = 0; i < childNodes.length; i++) { @@ -190,15 +190,13 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter { getShadowRoot(el: HTMLElement): DocumentFragment { return (el).shadowRoot; } getHost(el: HTMLElement): HTMLElement { return (el).host; } clone(node: Node): Node { return node.cloneNode(true); } - getElementsByClassName(element, name: string): List { + getElementsByClassName(element, name: string): HTMLElement[] { return element.getElementsByClassName(name); } - getElementsByTagName(element, name: string): List { + getElementsByTagName(element, name: string): HTMLElement[] { return element.getElementsByTagName(name); } - classList(element): List { - return >Array.prototype.slice.call(element.classList, 0); - } + classList(element): any[] { return Array.prototype.slice.call(element.classList, 0); } addClass(element, classname: string) { element.classList.add(classname); } removeClass(element, classname: string) { element.classList.remove(classname); } hasClass(element, classname: string): boolean { return element.classList.contains(classname); } diff --git a/modules/angular2/src/core/dom/dom_adapter.ts b/modules/angular2/src/core/dom/dom_adapter.ts index 0459331406..0a2d58fc27 100644 --- a/modules/angular2/src/core/dom/dom_adapter.ts +++ b/modules/angular2/src/core/dom/dom_adapter.ts @@ -22,7 +22,7 @@ export class DomAdapter { hasProperty(element, name: string): boolean { throw _abstract(); } setProperty(el: Element, name: string, value: any) { throw _abstract(); } getProperty(el: Element, name: string): any { throw _abstract(); } - invoke(el: Element, methodName: string, args: List): any { throw _abstract(); } + invoke(el: Element, methodName: string, args: any[]): any { throw _abstract(); } logError(error) { throw _abstract(); } log(error) { throw _abstract(); } @@ -38,7 +38,7 @@ export class DomAdapter { parse(templateHtml: string) { throw _abstract(); } query(selector: string): any { throw _abstract(); } querySelector(el, selector: string): HTMLElement { throw _abstract(); } - querySelectorAll(el, selector: string): List { throw _abstract(); } + querySelectorAll(el, selector: string): any[] { throw _abstract(); } on(el, evt, listener) { throw _abstract(); } onAndCancel(el, evt, listener): Function { throw _abstract(); } dispatchEvent(el, evt) { throw _abstract(); } @@ -55,8 +55,8 @@ export class DomAdapter { firstChild(el): Node { throw _abstract(); } nextSibling(el): Node { throw _abstract(); } parentElement(el): Node { throw _abstract(); } - childNodes(el): List { throw _abstract(); } - childNodesAsList(el): List { throw _abstract(); } + childNodes(el): Node[] { throw _abstract(); } + childNodesAsList(el): Node[] { throw _abstract(); } clearNodes(el) { throw _abstract(); } appendChild(el, node) { throw _abstract(); } removeChild(el, node) { throw _abstract(); } @@ -83,11 +83,11 @@ export class DomAdapter { createShadowRoot(el): any { throw _abstract(); } getShadowRoot(el): any { throw _abstract(); } getHost(el): any { throw _abstract(); } - getDistributedNodes(el): List { throw _abstract(); } + getDistributedNodes(el): Node[] { throw _abstract(); } clone /**/ (node: Node /*T*/): Node /*T*/ { throw _abstract(); } - getElementsByClassName(element, name: string): List { throw _abstract(); } - getElementsByTagName(element, name: string): List { throw _abstract(); } - classList(element): List { throw _abstract(); } + getElementsByClassName(element, name: string): HTMLElement[] { throw _abstract(); } + getElementsByTagName(element, name: string): HTMLElement[] { throw _abstract(); } + classList(element): any[] { throw _abstract(); } addClass(element, classname: string) { throw _abstract(); } removeClass(element, classname: string) { throw _abstract(); } hasClass(element, classname: string): boolean { throw _abstract(); } @@ -122,7 +122,7 @@ export class DomAdapter { getHref(element): string { throw _abstract(); } getEventKey(event): string { throw _abstract(); } resolveAndSetHref(element, baseUrl: string, href: string) { throw _abstract(); } - cssToRules(css: string): List { throw _abstract(); } + cssToRules(css: string): any[] { throw _abstract(); } supportsDOMEvents(): boolean { throw _abstract(); } supportsNativeShadowDOM(): boolean { throw _abstract(); } getGlobalEventTarget(target: string): any { throw _abstract(); } diff --git a/modules/angular2/src/core/dom/generic_browser_adapter.ts b/modules/angular2/src/core/dom/generic_browser_adapter.ts index ee260630e9..4fd74f4d76 100644 --- a/modules/angular2/src/core/dom/generic_browser_adapter.ts +++ b/modules/angular2/src/core/dom/generic_browser_adapter.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {isPresent, isFunction} from 'angular2/src/core/facade/lang'; import {DomAdapter} from './dom_adapter'; @@ -6,11 +6,11 @@ import {DomAdapter} from './dom_adapter'; * Provides DOM operations in any browser environment. */ export class GenericBrowserDomAdapter extends DomAdapter { - getDistributedNodes(el: HTMLElement): List { return (el).getDistributedNodes(); } + getDistributedNodes(el: HTMLElement): Node[] { return (el).getDistributedNodes(); } resolveAndSetHref(el: HTMLAnchorElement, baseUrl: string, href: string) { el.href = href == null ? baseUrl : baseUrl + '/../' + href; } - cssToRules(css: string): List { + cssToRules(css: string): any[] { var style = this.createStyleElement(css); this.appendChild(this.defaultDoc().head, style); var rules = []; diff --git a/modules/angular2/src/core/dom/parse5_adapter.ts b/modules/angular2/src/core/dom/parse5_adapter.ts index 375fc52934..347e6c9b89 100644 --- a/modules/angular2/src/core/dom/parse5_adapter.ts +++ b/modules/angular2/src/core/dom/parse5_adapter.ts @@ -7,7 +7,7 @@ var cssParse = require('css').parse; var url = require('url'); -import {List, MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {DomAdapter, setRootDomAdapter} from './dom_adapter'; import { BaseException, @@ -66,7 +66,7 @@ export class Parse5DomAdapter extends DomAdapter { query(selector) { throw _notImplemented('query'); } querySelector(el, selector: string): any { return this.querySelectorAll(el, selector)[0]; } - querySelectorAll(el, selector: string): List { + querySelectorAll(el, selector: string): any[] { var res = []; var _recursive = (result, node, selector, matcher) => { var cNodes = node.childNodes; @@ -131,7 +131,7 @@ export class Parse5DomAdapter extends DomAdapter { onAndCancel(el, evt, listener): Function { this.on(el, evt, listener); return () => { - ListWrapper.remove(StringMapWrapper.get>(el._eventListenersMap, evt), listener); + ListWrapper.remove(StringMapWrapper.get(el._eventListenersMap, evt), listener); }; } dispatchEvent(el, evt) { @@ -178,7 +178,7 @@ export class Parse5DomAdapter extends DomAdapter { nextSibling(el): Node { return el.nextSibling; } parentElement(el): Node { return el.parent; } childNodes(el): Node[] { return el.childNodes; } - childNodesAsList(el): List { + childNodesAsList(el): any[] { var childNodes = el.childNodes; var res = ListWrapper.createFixedSize(childNodes.length); for (var i = 0; i < childNodes.length; i++) { @@ -292,7 +292,7 @@ export class Parse5DomAdapter extends DomAdapter { } getShadowRoot(el): Element { return el.shadowRoot; } getHost(el): string { return el.host; } - getDistributedNodes(el: any): List { throw _notImplemented('getDistributedNodes'); } + getDistributedNodes(el: any): Node[] { throw _notImplemented('getDistributedNodes'); } clone(node: Node): Node { var _recursive = (node) => { var nodeClone = Object.create(Object.getPrototypeOf(node)); @@ -334,13 +334,13 @@ export class Parse5DomAdapter extends DomAdapter { }; return _recursive(node); } - getElementsByClassName(element, name: string): List { + getElementsByClassName(element, name: string): HTMLElement[] { return this.querySelectorAll(element, "." + name); } - getElementsByTagName(element: any, name: string): List { + getElementsByTagName(element: any, name: string): HTMLElement[] { throw _notImplemented('getElementsByTagName'); } - classList(element): List { + classList(element): string[] { var classAttrValue = null; var attributes = element.attribs; if (attributes && attributes.hasOwnProperty("class")) { @@ -518,7 +518,7 @@ export class Parse5DomAdapter extends DomAdapter { } return rules; } - cssToRules(css: string): List { + cssToRules(css: string): any[] { css = css.replace(/url\(\'(.+)\'\)/g, 'url($1)'); var rules = []; var parsedCSS = cssParse(css, {silent: true}); diff --git a/modules/angular2/src/core/facade/async.ts b/modules/angular2/src/core/facade/async.ts index 43f9d6e1e6..2b391f4258 100644 --- a/modules/angular2/src/core/facade/async.ts +++ b/modules/angular2/src/core/facade/async.ts @@ -1,7 +1,6 @@ /// import {global, isPresent} from 'angular2/src/core/facade/lang'; -import {List} from 'angular2/src/core/facade/collection'; import * as Rx from 'rx'; export {Promise}; @@ -24,7 +23,7 @@ export class PromiseWrapper { return promise.catch(onError); } - static all(promises: List): Promise { + static all(promises: any[]): Promise { if (promises.length == 0) return Promise.resolve([]); return Promise.all(promises); } diff --git a/modules/angular2/src/core/facade/collection.dart b/modules/angular2/src/core/facade/collection.dart index 7c4e7d8e87..1e5bb72628 100644 --- a/modules/angular2/src/core/facade/collection.dart +++ b/modules/angular2/src/core/facade/collection.dart @@ -115,10 +115,6 @@ class ListWrapper { static List createFixedSize(int size) => new List(size); static List createGrowableSize(int size) => new List.generate(size, (_) => null, growable: true); - static get(List m, int k) => m[k]; - static void set(List m, int k, v) { - m[k] = v; - } static bool contains(List m, k) => m.contains(k); static List map(list, fn(item)) => list.map(fn).toList(); diff --git a/modules/angular2/src/core/facade/collection.ts b/modules/angular2/src/core/facade/collection.ts index 384c30006f..dd3f4ef99e 100644 --- a/modules/angular2/src/core/facade/collection.ts +++ b/modules/angular2/src/core/facade/collection.ts @@ -1,21 +1,19 @@ import {isJsObject, global, isPresent, isBlank, isArray} from 'angular2/src/core/facade/lang'; -export var List = global.Array; export var Map = global.Map; export var Set = global.Set; export var StringMap = global.Object; // Safari and Internet Explorer do not support the iterable parameter to the // Map constructor. We work around that by manually adding the items. -var createMapFromPairs: {(pairs: List): Map} = (function() { +var createMapFromPairs: {(pairs: any[]): Map} = (function() { try { if (new Map([[1, 2]]).size === 1) { - return function createMapFromPairs(pairs: List): - Map { return new Map(pairs); }; + return function createMapFromPairs(pairs: any[]): Map { return new Map(pairs); }; } } catch (e) { } - return function createMapAndPopulateFromPairs(pairs: List): Map { + return function createMapAndPopulateFromPairs(pairs: any[]): Map { var map = new Map(); for (var i = 0; i < pairs.length; i++) { var pair = pairs[i]; @@ -54,19 +52,18 @@ var _clearValues: {(m: Map)} = (function() { })(); // Safari doesn't implement MapIterator.next(), which is used is Traceur's polyfill of Array.from // TODO(mlaval): remove the work around once we have a working polyfill of Array.from -var _arrayFromMap: {(m: Map, getValues: boolean): List} = (function() { +var _arrayFromMap: {(m: Map, getValues: boolean): any[]} = (function() { try { if (((new Map()).values()).next) { - return function createArrayFromMap(m: Map, getValues: boolean): List { - return getValues ? (Array).from(m.values()) : (Array).from(m.keys()); - }; + return function createArrayFromMap(m: Map, getValues: boolean): + any[] { return getValues ? (Array).from(m.values()) : (Array).from(m.keys()); }; } } catch (e) { } - return function createArrayFromMapWithForeach(m: Map, getValues: boolean): List { + return function createArrayFromMapWithForeach(m: Map, getValues: boolean): any[] { var res = ListWrapper.createFixedSize(m.size), i = 0; m.forEach((v, k) => { - ListWrapper.set(res, i, getValues ? v : k); + res[i] = getValues ? v : k; i++; }); return res; @@ -87,15 +84,15 @@ export class MapWrapper { m.forEach((v, k) => r[k] = v); return r; } - static createFromPairs(pairs: List): Map { return createMapFromPairs(pairs); } + static createFromPairs(pairs: any[]): Map { return createMapFromPairs(pairs); } static forEach(m: Map, fn: /*(V, K) => void*/ Function) { m.forEach(fn); } static get(map: Map, key: K): V { return map.get(key); } static size(m: Map): number { return m.size; } static delete(m: Map, k: K) { m.delete(k); } static clearValues(m: Map) { _clearValues(m); } static iterable(m: T): T { return m; } - static keys(m: Map): List { return _arrayFromMap(m, false); } - static values(m: Map): List { return _arrayFromMap(m, true); } + static keys(m: Map): K[] { return _arrayFromMap(m, false); } + static values(m: Map): V[] { return _arrayFromMap(m, true); } } /** @@ -115,7 +112,7 @@ export class StringMapWrapper { return map.hasOwnProperty(key) ? map[key] : undefined; } static set(map: StringMap, key: string, value: V) { map[key] = value; } - static keys(map: StringMap): List { return Object.keys(map); } + static keys(map: StringMap): string[] { return Object.keys(map); } static isEmpty(map: StringMap): boolean { for (var prop in map) { return false; @@ -171,71 +168,69 @@ export interface Predicate { (value: T, index?: number, array?: T[]): boolean export class ListWrapper { // JS has no way to express a staticly fixed size list, but dart does so we // keep both methods. - static createFixedSize(size: number): List { return new List(size); } - static createGrowableSize(size: number): List { return new List(size); } - static get(m: List, k: number): T { return m[k]; } - static set(m: List, k: number, v: T) { m[k] = v; } - static clone(array: List): T[] { return array.slice(0); } - static map(array: List, fn: (T) => V): List { return array.map(fn); } - static forEach(array: List, fn: (T) => void) { + static createFixedSize(size: number): any[] { return new Array(size); } + static createGrowableSize(size: number): any[] { return new Array(size); } + static clone(array: T[]): T[] { return array.slice(0); } + static map(array: T[], fn: (T) => V): V[] { return array.map(fn); } + static forEach(array: T[], fn: (T) => void) { for (var i = 0; i < array.length; i++) { fn(array[i]); } } - static forEachWithIndex(array: List, fn: (T, number) => void) { + static forEachWithIndex(array: T[], fn: (T, number) => void) { for (var i = 0; i < array.length; i++) { fn(array[i], i); } } - static first(array: List): T { + static first(array: T[]): T { if (!array) return null; return array[0]; } - static last(array: List): T { + static last(array: T[]): T { if (!array || array.length == 0) return null; return array[array.length - 1]; } - static find(list: List, pred: Predicate): T { + static find(list: T[], pred: Predicate): T { for (var i = 0; i < list.length; ++i) { if (pred(list[i])) return list[i]; } return null; } - static indexOf(array: List, value: T, startIndex: number = 0): number { + static indexOf(array: T[], value: T, startIndex: number = 0): number { return array.indexOf(value, startIndex); } - static reduce(list: List, + static reduce(list: T[], fn: (accumValue: E, currentValue: T, currentIndex: number, array: T[]) => E, init: E): E { return list.reduce(fn, init); } - static filter(array: List, pred: Predicate): T[] { return array.filter(pred); } - static any(list: List, pred: Function): boolean { + static filter(array: T[], pred: Predicate): T[] { return array.filter(pred); } + static any(list: any[], pred: Function): boolean { for (var i = 0; i < list.length; ++i) { if (pred(list[i])) return true; } return false; } - static contains(list: List, el: T): boolean { return list.indexOf(el) !== -1; } - static reversed(array: List): T[] { + static contains(list: T[], el: T): boolean { return list.indexOf(el) !== -1; } + static reversed(array: T[]): T[] { var a = ListWrapper.clone(array); return a.reverse(); } - static concat(a: List, b: List): List { return a.concat(b); } - static insert(list: List, index: number, value: T) { list.splice(index, 0, value); } - static removeAt(list: List, index: number): T { + static concat(a: any[], b: any[]): any[] { return a.concat(b); } + static insert(list: T[], index: number, value: T) { list.splice(index, 0, value); } + static removeAt(list: T[], index: number): T { var res = list[index]; list.splice(index, 1); return res; } - static removeAll(list: List, items: List) { + static removeAll(list: T[], items: T[]) { for (var i = 0; i < items.length; ++i) { var index = list.indexOf(items[i]); list.splice(index, 1); } } - static removeLast(list: List): T { return list.pop(); } - static remove(list: List, el: T): boolean { + static removeLast(list: T[]): T { return list.pop(); } + static remove(list: T[], el: T): boolean { var index = list.indexOf(el); if (index > -1) { list.splice(index, 1); @@ -243,36 +238,34 @@ export class ListWrapper { } return false; } - static clear(list: List) { list.splice(0, list.length); } - static join(list: List, s: string): string { return list.join(s); } - static isEmpty(list: List): boolean { return list.length == 0; } - static fill(list: List, value: any, start: number = 0, end: number = null) { + static clear(list: any[]) { list.splice(0, list.length); } + static join(list: any[], s: string): string { return list.join(s); } + static isEmpty(list: any[]): boolean { return list.length == 0; } + static fill(list: any[], value: any, start: number = 0, end: number = null) { list.fill(value, start, end === null ? list.length : end); } - static equals(a: List, b: List): boolean { + static equals(a: any[], b: any[]): boolean { if (a.length != b.length) return false; for (var i = 0; i < a.length; ++i) { if (a[i] !== b[i]) return false; } return true; } - static slice(l: List, from: number = 0, to: number = null): List { + static slice(l: T[], from: number = 0, to: number = null): T[] { return l.slice(from, to === null ? undefined : to); } - static splice(l: List, from: number, length: number): List { - return l.splice(from, length); - } - static sort(l: List, compareFn?: (a: T, b: T) => number) { + static splice(l: T[], from: number, length: number): T[] { return l.splice(from, length); } + static sort(l: T[], compareFn?: (a: T, b: T) => number) { if (isPresent(compareFn)) { l.sort(compareFn); } else { l.sort(); } } - static toString(l: List): string { return l.toString(); } - static toJSON(l: List): string { return JSON.stringify(l); } + static toString(l: T[]): string { return l.toString(); } + static toJSON(l: T[]): string { return JSON.stringify(l); } - static maximum(list: List, predicate: (T) => number): T { + static maximum(list: T[], predicate: (T) => number): T { if (list.length == 0) { return null; } @@ -316,12 +309,12 @@ export function iterateListLike(obj: any, fn: Function) { // Safari and Internet Explorer do not support the iterable parameter to the // Set constructor. We work around that by manually adding the items. -var createSetFromList: {(lst: List): Set} = (function() { +var createSetFromList: {(lst: any[]): Set} = (function() { var test = new Set([1, 2, 3]); if (test.size === 3) { - return function createSetFromList(lst: List): Set { return new Set(lst); }; + return function createSetFromList(lst: any[]): Set { return new Set(lst); }; } else { - return function createSetAndPopulateFromList(lst: List): Set { + return function createSetAndPopulateFromList(lst: any[]): Set { var res = new Set(lst); if (res.size !== lst.length) { for (var i = 0; i < lst.length; i++) { @@ -333,7 +326,7 @@ var createSetFromList: {(lst: List): Set} = (function() { } })(); export class SetWrapper { - static createFromList(lst: List): Set { return createSetFromList(lst); } + static createFromList(lst: T[]): Set { return createSetFromList(lst); } static has(s: Set, key: T): boolean { return s.has(key); } static delete(m: Set, k: K) { m.delete(k); } } diff --git a/modules/angular2/src/core/facade/lang.ts b/modules/angular2/src/core/facade/lang.ts index 31c1cf3c6f..4141969bd5 100644 --- a/modules/angular2/src/core/facade/lang.ts +++ b/modules/angular2/src/core/facade/lang.ts @@ -159,7 +159,7 @@ export class StringWrapper { static charCodeAt(s: string, index: number): number { return s.charCodeAt(index); } - static split(s: string, regExp: RegExp): List { return s.split(regExp); } + static split(s: string, regExp: RegExp): string[] { return s.split(regExp); } static equals(s: string, s2: string): boolean { return s === s2; } @@ -269,7 +269,7 @@ export class RegExpWrapper { flags = flags.replace(/g/g, ''); return new _global.RegExp(regExpStr, flags + 'g'); } - static firstMatch(regExp: RegExp, input: string): List { + static firstMatch(regExp: RegExp, input: string): string[] { // Reset multimatch regex state regExp.lastIndex = 0; return regExp.exec(input); diff --git a/modules/angular2/src/core/metadata.ts b/modules/angular2/src/core/metadata.ts index 85572e3412..6f62a15200 100644 --- a/modules/angular2/src/core/metadata.ts +++ b/modules/angular2/src/core/metadata.ts @@ -57,11 +57,11 @@ export interface ComponentDecorator extends TypeDecorator { View(obj: { templateUrl?: string, template?: string, - directives?: List>, - pipes?: List>, + directives?: Array, + pipes?: Array, renderer?: string, - styles?: List, - styleUrls?: List, + styles?: string[], + styleUrls?: string[], }): ViewDecorator; } @@ -77,11 +77,11 @@ export interface ViewDecorator extends TypeDecorator { View(obj: { templateUrl?: string, template?: string, - directives?: List>, - pipes?: List>, + directives?: Array, + pipes?: Array, renderer?: string, - styles?: List, - styleUrls?: List, + styles?: string[], + styleUrls?: string[], }): ViewDecorator; } @@ -127,14 +127,14 @@ export interface ViewDecorator extends TypeDecorator { */ export interface DirectiveFactory { (obj: { - selector?: string, properties?: List, events?: List, - host?: StringMap, lifecycle?: List, bindings?: List, - exportAs?: string, compileChildren?: boolean; + selector?: string, properties?: string[], events?: string[], host?: StringMap, + lifecycle?: LifecycleEvent[], bindings?: any[], exportAs?: string, + compileChildren?: boolean; }): DirectiveDecorator; new (obj: { - selector?: string, properties?: List, events?: List, - host?: StringMap, lifecycle?: List, bindings?: List, - exportAs?: string, compileChildren?: boolean; + selector?: string, properties?: string[], events?: string[], host?: StringMap, + lifecycle?: LifecycleEvent[], bindings?: any[], exportAs?: string, + compileChildren?: boolean; }): DirectiveMetadata; } @@ -184,26 +184,26 @@ export interface DirectiveFactory { export interface ComponentFactory { (obj: { selector?: string, - properties?: List, - events?: List, + properties?: string[], + events?: string[], host?: StringMap, - lifecycle?: List, - bindings?: List, + lifecycle?: LifecycleEvent[], + bindings?: any[], exportAs?: string, compileChildren?: boolean, - viewBindings?: List, + viewBindings?: any[], changeDetection?: ChangeDetectionStrategy, }): ComponentDecorator; new (obj: { selector?: string, - properties?: List, - events?: List, + properties?: string[], + events?: string[], host?: StringMap, - lifecycle?: List, - bindings?: List, + lifecycle?: LifecycleEvent[], + bindings?: any[], exportAs?: string, compileChildren?: boolean, - viewBindings?: List, + viewBindings?: any[], changeDetection?: ChangeDetectionStrategy, }): ComponentMetadata; } @@ -255,18 +255,18 @@ export interface ViewFactory { (obj: { templateUrl?: string, template?: string, - directives?: List>, + directives?: Array, encapsulation?: ViewEncapsulation, - styles?: List, - styleUrls?: List, + styles?: string[], + styleUrls?: string[], }): ViewDecorator; new (obj: { templateUrl?: string, template?: string, - directives?: List>, + directives?: Array, encapsulation?: ViewEncapsulation, - styles?: List, - styleUrls?: List, + styles?: string[], + styleUrls?: string[], }): ViewMetadata; } diff --git a/modules/angular2/src/core/metadata/di.ts b/modules/angular2/src/core/metadata/di.ts index bf70cf2839..c8a08247fc 100644 --- a/modules/angular2/src/core/metadata/di.ts +++ b/modules/angular2/src/core/metadata/di.ts @@ -70,7 +70,7 @@ export class QueryMetadata extends DependencyMetadata { get isVarBindingQuery(): boolean { return isString(this.selector); } - get varBindings(): List { return StringWrapper.split(this.selector, new RegExp(",")); } + get varBindings(): string[] { return StringWrapper.split(this.selector, new RegExp(",")); } toString(): string { return `@Query(${stringify(this.selector)})`; } } diff --git a/modules/angular2/src/core/metadata/directives.ts b/modules/angular2/src/core/metadata/directives.ts index b795794d53..db5f312b7b 100644 --- a/modules/angular2/src/core/metadata/directives.ts +++ b/modules/angular2/src/core/metadata/directives.ts @@ -1,5 +1,4 @@ import {CONST, CONST_EXPR} from 'angular2/src/core/facade/lang'; -import {List} from 'angular2/src/core/facade/collection'; import {InjectableMetadata} from 'angular2/src/core/di/metadata'; import {ChangeDetectionStrategy} from 'angular2/change_detection'; @@ -482,7 +481,7 @@ export class DirectiveMetadata extends InjectableMetadata { * ``` * */ - properties: List; + properties: string[]; /** * Enumerates the set of emitted events. @@ -527,7 +526,7 @@ export class DirectiveMetadata extends InjectableMetadata { * ``` * */ - events: List; + events: string[]; /** * Specifiy the events, actions, properties and attributes related to the host element. @@ -636,7 +635,7 @@ export class DirectiveMetadata extends InjectableMetadata { * * See {@link LifecycleEvent} for details. */ - lifecycle: List; + lifecycle: LifecycleEvent[]; /** * If set to false the compiler does not compile the children of this directive. @@ -674,7 +673,7 @@ export class DirectiveMetadata extends InjectableMetadata { * } * ``` */ - bindings: List; + bindings: any[]; /** * Defines the name that can be used in the template to assign this directive to a variable. @@ -708,11 +707,11 @@ export class DirectiveMetadata extends InjectableMetadata { compileChildren = true, }: { selector?: string, - properties?: List, - events?: List, + properties?: string[], + events?: string[], host?: StringMap, - lifecycle?: List, - bindings?: List, + lifecycle?: LifecycleEvent[], + bindings?: any[], exportAs?: string, compileChildren?: boolean, } = {}) { @@ -817,19 +816,19 @@ export class ComponentMetadata extends DirectiveMetadata { * * ``` */ - viewBindings: List; + viewBindings: any[]; constructor({selector, properties, events, host, exportAs, lifecycle, bindings, viewBindings, changeDetection = ChangeDetectionStrategy.Default, compileChildren = true}: { selector?: string, - properties?: List, - events?: List, + properties?: string[], + events?: string[], host?: StringMap, - lifecycle?: List, - bindings?: List, + lifecycle?: LifecycleEvent[], + bindings?: any[], exportAs?: string, compileChildren?: boolean, - viewBindings?: List, + viewBindings?: any[], changeDetection?: ChangeDetectionStrategy, } = {}) { super({ diff --git a/modules/angular2/src/core/metadata/view.ts b/modules/angular2/src/core/metadata/view.ts index 417e2649bc..a791566872 100644 --- a/modules/angular2/src/core/metadata/view.ts +++ b/modules/angular2/src/core/metadata/view.ts @@ -53,12 +53,12 @@ export class ViewMetadata { /** * Specifies stylesheet URLs for an angular component. */ - styleUrls: List; + styleUrls: string[]; /** * Specifies an inline stylesheet for an angular component. */ - styles: List; + styles: string[]; /** * Specifies a list of directives that can be used within a template. @@ -82,12 +82,12 @@ export class ViewMetadata { * } * ``` */ - // TODO(tbosch): use Type | Binding | List when Dart supports union types, + // TODO(tbosch): use Type | Binding | any[] when Dart supports union types, // as otherwise we would need to import Binding type and Dart would warn // for an unused import. - directives: List>; + directives: Array; - pipes: List>; + pipes: Array; /** * Specify how the template and the styles should be encapsulated. @@ -100,11 +100,11 @@ export class ViewMetadata { constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls}: { templateUrl?: string, template?: string, - directives?: List>, - pipes?: List>, + directives?: Array, + pipes?: Array, encapsulation?: ViewEncapsulation, - styles?: List, - styleUrls?: List, + styles?: string[], + styleUrls?: string[], } = {}) { this.templateUrl = templateUrl; this.template = template; diff --git a/modules/angular2/src/core/pipes/date_pipe.ts b/modules/angular2/src/core/pipes/date_pipe.ts index 8605c760ad..c9d39c12a7 100644 --- a/modules/angular2/src/core/pipes/date_pipe.ts +++ b/modules/angular2/src/core/pipes/date_pipe.ts @@ -93,7 +93,7 @@ export class DatePipe implements PipeTransform { }; - transform(value: any, args: List): string { + transform(value: any, args: any[]): string { if (isBlank(value)) return null; if (!this.supports(value)) { diff --git a/modules/angular2/src/core/pipes/json_pipe.ts b/modules/angular2/src/core/pipes/json_pipe.ts index cdb27dfbea..2f1e3577fd 100644 --- a/modules/angular2/src/core/pipes/json_pipe.ts +++ b/modules/angular2/src/core/pipes/json_pipe.ts @@ -32,5 +32,5 @@ import {Pipe} from '../metadata'; @Pipe({name: 'json'}) @Injectable() export class JsonPipe implements PipeTransform { - transform(value: any, args: List = null): string { return Json.stringify(value); } + transform(value: any, args: any[] = null): string { return Json.stringify(value); } } diff --git a/modules/angular2/src/core/pipes/limit_to_pipe.ts b/modules/angular2/src/core/pipes/limit_to_pipe.ts index ce2a0ea250..1a47377ba9 100644 --- a/modules/angular2/src/core/pipes/limit_to_pipe.ts +++ b/modules/angular2/src/core/pipes/limit_to_pipe.ts @@ -16,7 +16,7 @@ import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; import {Pipe} from '../metadata'; /** - * Creates a new List or String containing only a prefix/suffix of the + * Creates a new Array or String containing only a prefix/suffix of the * elements. * * The number of elements to return is specified by the `limitTo` parameter. @@ -25,19 +25,19 @@ import {Pipe} from '../metadata'; * * expression | limitTo:number * - * Where the input expression is a [List] or [String], and `limitTo` is: + * Where the input expression is a [Array] or [String], and `limitTo` is: * * - **a positive integer**: return _number_ items from the beginning of the list or string * expression. * - **a negative integer**: return _number_ items from the end of the list or string expression. * - **`|limitTo|` greater than the size of the expression**: return the entire expression. * - * When operating on a [List], the returned list is always a copy even when all + * When operating on a [Array], the returned list is always a copy even when all * the elements are being returned. * * # Examples * - * ## List Example + * ## Array Example * * Assuming `var collection = ['a', 'b', 'c']`, this `ng-for` directive: * @@ -59,7 +59,7 @@ import {Pipe} from '../metadata'; export class LimitToPipe implements PipeTransform { supports(obj: any): boolean { return isString(obj) || isArray(obj); } - transform(value: any, args: List = null): any { + transform(value: any, args: any[] = null): any { if (isBlank(args) || args.length == 0) { throw new BaseException('limitTo pipe requires one argument'); } diff --git a/modules/angular2/src/core/pipes/lowercase_pipe.ts b/modules/angular2/src/core/pipes/lowercase_pipe.ts index ae2e469945..fae1916c33 100644 --- a/modules/angular2/src/core/pipes/lowercase_pipe.ts +++ b/modules/angular2/src/core/pipes/lowercase_pipe.ts @@ -31,7 +31,7 @@ import {Pipe} from '../metadata'; @Pipe({name: 'lowercase'}) @Injectable() export class LowerCasePipe implements PipeTransform { - transform(value: string, args: List = null): string { + transform(value: string, args: any[] = null): string { if (isBlank(value)) return value; if (!isString(value)) { throw new InvalidPipeArgumentException(LowerCasePipe, value); diff --git a/modules/angular2/src/core/pipes/uppercase_pipe.ts b/modules/angular2/src/core/pipes/uppercase_pipe.ts index ef6b07f36b..cd811ca1c5 100644 --- a/modules/angular2/src/core/pipes/uppercase_pipe.ts +++ b/modules/angular2/src/core/pipes/uppercase_pipe.ts @@ -30,7 +30,7 @@ import {Pipe} from '../metadata'; @Pipe({name: 'uppercase'}) @Injectable() export class UpperCasePipe implements PipeTransform { - transform(value: string, args: List = null): string { + transform(value: string, args: any[] = null): string { if (isBlank(value)) return value; if (!isString(value)) { throw new InvalidPipeArgumentException(UpperCasePipe, value); diff --git a/modules/angular2/src/core/reflection/platform_reflection_capabilities.ts b/modules/angular2/src/core/reflection/platform_reflection_capabilities.ts index 3ceba5f918..3bd9c51d99 100644 --- a/modules/angular2/src/core/reflection/platform_reflection_capabilities.ts +++ b/modules/angular2/src/core/reflection/platform_reflection_capabilities.ts @@ -1,13 +1,12 @@ import {Type} from 'angular2/src/core/facade/lang'; import {GetterFn, SetterFn, MethodFn} from './types'; -import {List} from 'angular2/src/core/facade/collection'; export interface PlatformReflectionCapabilities { isReflectionEnabled(): boolean; factory(type: Type): Function; - interfaces(type: Type): List; - parameters(type: Type): List>; - annotations(type: Type): List; + interfaces(type: Type): any[]; + parameters(type: Type): any[][]; + annotations(type: Type): any[]; getter(name: string): GetterFn; setter(name: string): SetterFn; method(name: string): MethodFn; diff --git a/modules/angular2/src/core/reflection/reflection.ts b/modules/angular2/src/core/reflection/reflection.ts index a91e0bada5..c1a2b85d54 100644 --- a/modules/angular2/src/core/reflection/reflection.ts +++ b/modules/angular2/src/core/reflection/reflection.ts @@ -1,5 +1,5 @@ import {Type, isPresent} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Reflector} from './reflector'; export {Reflector, ReflectionInfo} from './reflector'; import {ReflectionCapabilities} from './reflection_capabilities'; diff --git a/modules/angular2/src/core/reflection/reflection_capabilities.ts b/modules/angular2/src/core/reflection/reflection_capabilities.ts index 366bc800ed..c53c1d3a9b 100644 --- a/modules/angular2/src/core/reflection/reflection_capabilities.ts +++ b/modules/angular2/src/core/reflection/reflection_capabilities.ts @@ -6,7 +6,7 @@ import { stringify, BaseException } from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {GetterFn, SetterFn, MethodFn} from './types'; import {PlatformReflectionCapabilities} from 'platform_reflection_capabilities'; @@ -82,7 +82,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities { `Cannot create a factory for '${stringify(t)}' because its constructor has more than 20 arguments`); } - _zipTypesAndAnnotaions(paramTypes, paramAnnotations): List> { + _zipTypesAndAnnotaions(paramTypes, paramAnnotations): any[][] { var result; if (typeof paramTypes === 'undefined') { @@ -109,7 +109,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities { return result; } - parameters(typeOfFunc: Type): List> { + parameters(typeOfFunc: Type): any[][] { // Prefer the direct API. if (isPresent((typeOfFunc).parameters)) { return (typeOfFunc).parameters; @@ -124,7 +124,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities { return ListWrapper.createFixedSize((typeOfFunc).length); } - annotations(typeOfFunc: Type): List { + annotations(typeOfFunc: Type): any[] { // Prefer the direct API. if (isPresent((typeOfFunc).annotations)) { var annotations = (typeOfFunc).annotations; @@ -140,7 +140,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities { return []; } - interfaces(type: Type): List { + interfaces(type: Type): any[] { throw new BaseException("JavaScript does not support interfaces"); } diff --git a/modules/angular2/src/core/reflection/reflector.ts b/modules/angular2/src/core/reflection/reflector.ts index 28a4569df4..1cda681a77 100644 --- a/modules/angular2/src/core/reflection/reflector.ts +++ b/modules/angular2/src/core/reflection/reflector.ts @@ -1,6 +1,5 @@ import {Type, isPresent, stringify, BaseException} from 'angular2/src/core/facade/lang'; import { - List, ListWrapper, Map, MapWrapper, @@ -16,12 +15,11 @@ export {PlatformReflectionCapabilities} from './platform_reflection_capabilities export class ReflectionInfo { _factory: Function; - _annotations: List; - _parameters: List>; - _interfaces: List; + _annotations: any[]; + _parameters: any[][]; + _interfaces: any[]; - constructor(annotations?: List, parameters?: List>, factory?: Function, - interfaces?: List) { + constructor(annotations?: any[], parameters?: any[][], factory?: Function, interfaces?: any[]) { this._annotations = annotations; this._parameters = parameters; this._factory = factory; @@ -59,7 +57,7 @@ export class Reflector { * {@link #trackUsage} was called. This list could later be audited as * potential dead code. */ - listUnusedKeys(): List { + listUnusedKeys(): any[] { if (this._usedKeys == null) { throw new BaseException('Usage tracking is disabled'); } @@ -96,7 +94,7 @@ export class Reflector { } } - parameters(typeOrFunc: /*Type*/ any): List { + parameters(typeOrFunc: /*Type*/ any): any[] { if (this._injectableInfo.has(typeOrFunc)) { var res = this._getReflectionInfo(typeOrFunc)._parameters; return isPresent(res) ? res : []; @@ -105,7 +103,7 @@ export class Reflector { } } - annotations(typeOrFunc: /*Type*/ any): List { + annotations(typeOrFunc: /*Type*/ any): any[] { if (this._injectableInfo.has(typeOrFunc)) { var res = this._getReflectionInfo(typeOrFunc)._annotations; return isPresent(res) ? res : []; @@ -114,7 +112,7 @@ export class Reflector { } } - interfaces(type: Type): List { + interfaces(type: Type): any[] { if (this._injectableInfo.has(type)) { var res = this._getReflectionInfo(type)._interfaces; return isPresent(res) ? res : []; diff --git a/modules/angular2/src/core/reflection/types.ts b/modules/angular2/src/core/reflection/types.ts index 9570f38370..36931562c3 100644 --- a/modules/angular2/src/core/reflection/types.ts +++ b/modules/angular2/src/core/reflection/types.ts @@ -1,6 +1,5 @@ import {Type} from 'angular2/src/core/facade/lang'; -import {List} from 'angular2/src/core/facade/collection'; export type SetterFn = (obj: any, value: any) => void; export type GetterFn = (obj: any) => any; -export type MethodFn = (obj: any, args: List) => any; +export type MethodFn = (obj: any, args: any[]) => any; diff --git a/modules/angular2/src/core/render/api.ts b/modules/angular2/src/core/render/api.ts index 5faae24d16..148f6f990c 100644 --- a/modules/angular2/src/core/render/api.ts +++ b/modules/angular2/src/core/render/api.ts @@ -1,12 +1,6 @@ import {isPresent, isBlank, RegExpWrapper} from 'angular2/src/core/facade/lang'; import {Promise} from 'angular2/src/core/facade/async'; -import { - List, - Map, - MapWrapper, - StringMap, - StringMapWrapper -} from 'angular2/src/core/facade/collection'; +import {Map, MapWrapper, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; import { ASTWithSource, ChangeDetectionStrategy @@ -49,14 +43,14 @@ export class RenderElementBinder { index: number; parentIndex: number; distanceToParent: number; - directives: List; + directives: DirectiveBinder[]; nestedProtoView: ProtoViewDto; - propertyBindings: List; + propertyBindings: ElementPropertyBinding[]; variableBindings: Map; // Note: this contains a preprocessed AST // that replaced the values that should be extracted from the element // with a local name - eventBindings: List; + eventBindings: EventBinding[]; readAttributes: Map; constructor({index, parentIndex, distanceToParent, directives, nestedProtoView, propertyBindings, @@ -64,11 +58,11 @@ export class RenderElementBinder { index?: number, parentIndex?: number, distanceToParent?: number, - directives?: List, + directives?: DirectiveBinder[], nestedProtoView?: ProtoViewDto, - propertyBindings?: List, + propertyBindings?: ElementPropertyBinding[], variableBindings?: Map, - eventBindings?: List, + eventBindings?: EventBinding[], readAttributes?: Map } = {}) { this.index = index; @@ -90,13 +84,13 @@ export class DirectiveBinder { // Note: this contains a preprocessed AST // that replaced the values that should be extracted from the element // with a local name - eventBindings: List; - hostPropertyBindings: List; + eventBindings: EventBinding[]; + hostPropertyBindings: ElementPropertyBinding[]; constructor({directiveIndex, propertyBindings, eventBindings, hostPropertyBindings}: { directiveIndex?: number, propertyBindings?: Map, - eventBindings?: List, - hostPropertyBindings?: List + eventBindings?: EventBinding[], + hostPropertyBindings?: ElementPropertyBinding[] }) { this.directiveIndex = directiveIndex; this.propertyBindings = propertyBindings; @@ -119,19 +113,19 @@ export enum ViewType { export class ProtoViewDto { render: RenderProtoViewRef; - elementBinders: List; + elementBinders: RenderElementBinder[]; variableBindings: Map; type: ViewType; - textBindings: List; + textBindings: ASTWithSource[]; transitiveNgContentCount: number; constructor({render, elementBinders, variableBindings, type, textBindings, transitiveNgContentCount}: { render?: RenderProtoViewRef, - elementBinders?: List, + elementBinders?: RenderElementBinder[], variableBindings?: Map, type?: ViewType, - textBindings?: List, + textBindings?: ASTWithSource[], transitiveNgContentCount?: number }) { this.render = render; @@ -149,9 +143,9 @@ export class RenderDirectiveMetadata { id: any; selector: string; compileChildren: boolean; - events: List; - properties: List; - readAttributes: List; + events: string[]; + properties: string[]; + readAttributes: string[]; type: number; callOnDestroy: boolean; callOnChanges: boolean; @@ -177,12 +171,12 @@ export class RenderDirectiveMetadata { id?: string, selector?: string, compileChildren?: boolean, - events?: List, + events?: string[], hostListeners?: Map, hostProperties?: Map, hostAttributes?: Map, - properties?: List, - readAttributes?: List, + properties?: string[], + readAttributes?: string[], type?: number, callOnDestroy?: boolean, callOnChanges?: boolean, @@ -224,10 +218,10 @@ export class RenderDirectiveMetadata { id?: string, selector?: string, compileChildren?: boolean, - events?: List, + events?: string[], host?: Map, - properties?: List, - readAttributes?: List, + properties?: string[], + readAttributes?: string[], type?: number, callOnDestroy?: boolean, callOnChanges?: boolean, @@ -314,9 +308,9 @@ export class ViewDefinition { componentId: string; templateAbsUrl: string; template: string; - directives: List; - styleAbsUrls: List; - styles: List; + directives: RenderDirectiveMetadata[]; + styleAbsUrls: string[]; + styles: string[]; encapsulation: ViewEncapsulation; constructor({componentId, templateAbsUrl, template, styleAbsUrls, styles, directives, @@ -324,9 +318,9 @@ export class ViewDefinition { componentId?: string, templateAbsUrl?: string, template?: string, - styleAbsUrls?: List, - styles?: List, - directives?: List, + styleAbsUrls?: string[], + styles?: string[], + directives?: RenderDirectiveMetadata[], encapsulation?: ViewEncapsulation } = {}) { this.componentId = componentId; @@ -381,11 +375,11 @@ export class RenderCompiler { * should be merged. * If the array contains other arrays, they will be merged before processing the parent array. * The array must contain an entry for every component and embedded ProtoView of the first entry. - * @param protoViewRefs List of ProtoViewRefs or nested + * @param protoViewRefs Array of ProtoViewRefs or nested * @return the merge result */ mergeProtoViewsRecursively( - protoViewRefs: List>): Promise { + protoViewRefs: Array): Promise { return null; } } @@ -500,7 +494,7 @@ export class Renderer { /** * Calls a method on an element. */ - invokeElementMethod(location: RenderElementRef, methodName: string, args: List) {} + invokeElementMethod(location: RenderElementRef, methodName: string, args: any[]) {} /** * Sets the value of a text node. diff --git a/modules/angular2/src/core/render/dom/compiler/compile_control.ts b/modules/angular2/src/core/render/dom/compiler/compile_control.ts index 4f11e61a9c..bd64e58263 100644 --- a/modules/angular2/src/core/render/dom/compiler/compile_control.ts +++ b/modules/angular2/src/core/render/dom/compiler/compile_control.ts @@ -1,5 +1,4 @@ import {isBlank} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; import {CompileElement} from './compile_element'; import {CompileStep} from './compile_step'; @@ -14,7 +13,7 @@ export class CompileControl { _additionalChildren: CompileElement[] = null; _ignoreCurrentElement: boolean; - constructor(public _steps: List) {} + constructor(public _steps: CompileStep[]) {} // only public so that it can be used by compile_pipeline internalProcess(results: any[], startStepIndex: number, parent: CompileElement, diff --git a/modules/angular2/src/core/render/dom/compiler/compile_element.ts b/modules/angular2/src/core/render/dom/compiler/compile_element.ts index a5b2876dee..a1acc44d94 100644 --- a/modules/angular2/src/core/render/dom/compiler/compile_element.ts +++ b/modules/angular2/src/core/render/dom/compiler/compile_element.ts @@ -1,4 +1,4 @@ -import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; +import {Map, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import { isBlank, @@ -17,7 +17,7 @@ import {ProtoViewBuilder, ElementBinderBuilder} from '../view/proto_view_builder */ export class CompileElement { _attrs: Map = null; - _classList: List = null; + _classList: string[] = null; isViewRoot: boolean = false; // inherited down to children if they don't have an own protoView inheritedProtoView: ProtoViewBuilder = null; @@ -63,7 +63,7 @@ export class CompileElement { return this._attrs; } - classList(): List { + classList(): string[] { if (isBlank(this._classList)) { this._classList = []; var elClassList = DOM.classList(this.element); diff --git a/modules/angular2/src/core/render/dom/compiler/compile_pipeline.ts b/modules/angular2/src/core/render/dom/compiler/compile_pipeline.ts index 0d20f0dbb7..8ef3b6702f 100644 --- a/modules/angular2/src/core/render/dom/compiler/compile_pipeline.ts +++ b/modules/angular2/src/core/render/dom/compiler/compile_pipeline.ts @@ -1,5 +1,4 @@ import {isPresent, isBlank} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {CompileElement} from './compile_element'; import {CompileControl} from './compile_control'; @@ -13,7 +12,7 @@ import {ProtoViewDto, ViewType, ViewDefinition} from '../../api'; */ export class CompilePipeline { _control: CompileControl; - constructor(public steps: List) { this._control = new CompileControl(steps); } + constructor(public steps: CompileStep[]) { this._control = new CompileControl(steps); } processStyles(styles: string[]): string[] { return styles.map(style => { diff --git a/modules/angular2/src/core/render/dom/compiler/compile_step_factory.ts b/modules/angular2/src/core/render/dom/compiler/compile_step_factory.ts index 5f2b3b9955..d82ffc80dd 100644 --- a/modules/angular2/src/core/render/dom/compiler/compile_step_factory.ts +++ b/modules/angular2/src/core/render/dom/compiler/compile_step_factory.ts @@ -1,4 +1,3 @@ -import {List} from 'angular2/src/core/facade/collection'; import {Parser} from 'angular2/src/core/change_detection/change_detection'; import {ViewDefinition} from '../../api'; import {CompileStep} from './compile_step'; @@ -9,14 +8,14 @@ import {ViewSplitter} from './view_splitter'; import {StyleEncapsulator} from './style_encapsulator'; export class CompileStepFactory { - createSteps(view: ViewDefinition): List { return null; } + createSteps(view: ViewDefinition): CompileStep[] { return null; } } export class DefaultStepFactory extends CompileStepFactory { private _componentUIDsCache: Map = new Map(); constructor(private _parser: Parser, private _appId: string) { super(); } - createSteps(view: ViewDefinition): List { + createSteps(view: ViewDefinition): CompileStep[] { return [ new ViewSplitter(this._parser), new PropertyBindingParser(this._parser), diff --git a/modules/angular2/src/core/render/dom/compiler/compiler.ts b/modules/angular2/src/core/render/dom/compiler/compiler.ts index 093974a15f..04a9c20c06 100644 --- a/modules/angular2/src/core/render/dom/compiler/compiler.ts +++ b/modules/angular2/src/core/render/dom/compiler/compiler.ts @@ -68,7 +68,7 @@ export class DomCompiler extends RenderCompiler { } mergeProtoViewsRecursively( - protoViewRefs: List>): Promise { + protoViewRefs: Array): Promise { return PromiseWrapper.resolve( pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); } diff --git a/modules/angular2/src/core/render/dom/compiler/directive_parser.ts b/modules/angular2/src/core/render/dom/compiler/directive_parser.ts index 70fa28432b..5c089c3475 100644 --- a/modules/angular2/src/core/render/dom/compiler/directive_parser.ts +++ b/modules/angular2/src/core/render/dom/compiler/directive_parser.ts @@ -1,5 +1,5 @@ import {isPresent, isBlank, BaseException, StringWrapper} from 'angular2/src/core/facade/lang'; -import {List, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; +import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {Parser} from 'angular2/src/core/change_detection/change_detection'; @@ -21,7 +21,7 @@ import {DirectiveBuilder, ElementBinderBuilder} from '../view/proto_view_builder export class DirectiveParser implements CompileStep { _selectorMatcher: SelectorMatcher = new SelectorMatcher(); - constructor(public _parser: Parser, public _directives: List) { + constructor(public _parser: Parser, public _directives: RenderDirectiveMetadata[]) { for (var i = 0; i < _directives.length; i++) { var directive = _directives[i]; var selector = CssSelector.parse(directive.selector); @@ -114,7 +114,7 @@ export class DirectiveParser implements CompileStep { let dirProperty: string; // Name of the property on the element let elProp: string; - let pipes: List; + let pipes: string[]; let assignIndex: number = bindConfig.indexOf(':'); if (assignIndex > -1) { diff --git a/modules/angular2/src/core/render/dom/compiler/selector.ts b/modules/angular2/src/core/render/dom/compiler/selector.ts index 7694a988e3..a868e74ec8 100644 --- a/modules/angular2/src/core/render/dom/compiler/selector.ts +++ b/modules/angular2/src/core/render/dom/compiler/selector.ts @@ -1,4 +1,4 @@ -import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; +import {Map, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import { isPresent, isBlank, @@ -322,7 +322,7 @@ export class SelectorMatcher { var selectables = map.get(name); var starSelectables = map.get("*"); if (isPresent(starSelectables)) { - selectables = ListWrapper.concat(selectables, starSelectables); + selectables = selectables.concat(starSelectables); } if (isBlank(selectables)) { return false; diff --git a/modules/angular2/src/core/render/dom/compiler/shadow_css.ts b/modules/angular2/src/core/render/dom/compiler/shadow_css.ts index 4f6afd624b..fb92f0ac00 100644 --- a/modules/angular2/src/core/render/dom/compiler/shadow_css.ts +++ b/modules/angular2/src/core/render/dom/compiler/shadow_css.ts @@ -1,5 +1,5 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import { StringWrapper, RegExp, diff --git a/modules/angular2/src/core/render/dom/compiler/style_inliner.ts b/modules/angular2/src/core/render/dom/compiler/style_inliner.ts index b8c34416fd..948abf00d7 100644 --- a/modules/angular2/src/core/render/dom/compiler/style_inliner.ts +++ b/modules/angular2/src/core/render/dom/compiler/style_inliner.ts @@ -42,8 +42,7 @@ export class StyleInliner { return this._inlineImports(cssText, baseUrl, []); } - _inlineImports(cssText: string, baseUrl: string, inlinedUrls: List): Promise| - string { + _inlineImports(cssText: string, baseUrl: string, inlinedUrls: string[]): Promise| string { var partIndex = 0; var parts = StringWrapper.split(cssText, _importRe); diff --git a/modules/angular2/src/core/render/dom/compiler/view_loader.ts b/modules/angular2/src/core/render/dom/compiler/view_loader.ts index 05095389ab..44bb49081d 100644 --- a/modules/angular2/src/core/render/dom/compiler/view_loader.ts +++ b/modules/angular2/src/core/render/dom/compiler/view_loader.ts @@ -7,7 +7,7 @@ import { isPromise, StringWrapper } from 'angular2/src/core/facade/lang'; -import {Map, MapWrapper, ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {Map, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {ViewDefinition} from '../../api'; @@ -35,7 +35,7 @@ export class ViewLoader { load(viewDef: ViewDefinition): Promise { var r = wtfStartTimeRange('ViewLoader#load()', stringify(viewDef.componentId)); - let tplAndStyles: List| Promise| string> = + let tplAndStyles: Array| Promise| string> = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; if (isPresent(viewDef.styles)) { viewDef.styles.forEach((cssText: string) => { @@ -54,7 +54,7 @@ export class ViewLoader { // Inline the styles from the @View annotation return PromiseWrapper.all(tplAndStyles) - .then((res: List) => { + .then((res: Array) => { let loadedTplAndStyles = res[0]; let styles = ListWrapper.slice(res, 1); diff --git a/modules/angular2/src/core/render/dom/dom_renderer.ts b/modules/angular2/src/core/render/dom/dom_renderer.ts index d6e7a50bd6..e5d942717e 100644 --- a/modules/angular2/src/core/render/dom/dom_renderer.ts +++ b/modules/angular2/src/core/render/dom/dom_renderer.ts @@ -6,13 +6,6 @@ import { RegExpWrapper, CONST_EXPR } from 'angular2/src/core/facade/lang'; -import { - ListWrapper, - MapWrapper, - Map, - StringMapWrapper, - List -} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; @@ -96,9 +89,7 @@ export class DomRenderer extends Renderer { .boundElements[location.renderBoundElementIndex]; } - getRootNodes(fragment: RenderFragmentRef): List { - return resolveInternalDomFragment(fragment); - } + getRootNodes(fragment: RenderFragmentRef): Node[] { return resolveInternalDomFragment(fragment); } attachFragmentAfterFragment(previousFragmentRef: RenderFragmentRef, fragmentRef: RenderFragmentRef) { @@ -194,7 +185,7 @@ export class DomRenderer extends Renderer { view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); } - invokeElementMethod(location: RenderElementRef, methodName: string, args: List): void { + invokeElementMethod(location: RenderElementRef, methodName: string, args: any[]): void { if (isBlank(location.renderBoundElementIndex)) { return; } diff --git a/modules/angular2/src/core/render/dom/events/event_manager.ts b/modules/angular2/src/core/render/dom/events/event_manager.ts index 9d3399595c..91e3d94e05 100644 --- a/modules/angular2/src/core/render/dom/events/event_manager.ts +++ b/modules/angular2/src/core/render/dom/events/event_manager.ts @@ -1,12 +1,11 @@ import {isBlank, BaseException, isPresent, StringWrapper} from 'angular2/src/core/facade/lang'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; -import {List, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import {NgZone} from 'angular2/src/core/zone/ng_zone'; var BUBBLE_SYMBOL = '^'; export class EventManager { - constructor(public _plugins: List, public _zone: NgZone) { + constructor(public _plugins: EventManagerPlugin[], public _zone: NgZone) { for (var i = 0; i < _plugins.length; i++) { _plugins[i].manager = this; } diff --git a/modules/angular2/src/core/render/dom/view/element_binder.ts b/modules/angular2/src/core/render/dom/view/element_binder.ts index 8cd669799f..dd232f4022 100644 --- a/modules/angular2/src/core/render/dom/view/element_binder.ts +++ b/modules/angular2/src/core/render/dom/view/element_binder.ts @@ -1,22 +1,21 @@ import {AST} from 'angular2/src/core/change_detection/change_detection'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; import {isPresent} from 'angular2/src/core/facade/lang'; export class DomElementBinder { - textNodeIndices: List; + textNodeIndices: number[]; hasNestedProtoView: boolean; eventLocals: AST; - localEvents: List; - globalEvents: List; + localEvents: Event[]; + globalEvents: Event[]; hasNativeShadowRoot: boolean; constructor({textNodeIndices, hasNestedProtoView, eventLocals, localEvents, globalEvents, hasNativeShadowRoot}: { - textNodeIndices?: List, + textNodeIndices?: number[], hasNestedProtoView?: boolean, eventLocals?: AST, - localEvents?: List, - globalEvents?: List, + localEvents?: Event[], + globalEvents?: Event[], hasNativeShadowRoot?: boolean } = {}) { this.textNodeIndices = textNodeIndices; diff --git a/modules/angular2/src/core/render/dom/view/proto_view.ts b/modules/angular2/src/core/render/dom/view/proto_view.ts index 9c697379c7..661e2b52e5 100644 --- a/modules/angular2/src/core/render/dom/view/proto_view.ts +++ b/modules/angular2/src/core/render/dom/view/proto_view.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {DomElementBinder} from './element_binder'; import {RenderProtoViewRef, ViewType, ViewEncapsulation} from '../../api'; @@ -18,7 +18,7 @@ export class DomProtoViewRef extends RenderProtoViewRef { export class DomProtoView { static create(templateCloner: TemplateCloner, type: ViewType, rootElement: Element, viewEncapsulation: ViewEncapsulation, fragmentsRootNodeCount: number[], - rootTextNodeIndices: number[], elementBinders: List, + rootTextNodeIndices: number[], elementBinders: DomElementBinder[], hostAttributes: Map): DomProtoView { var boundTextNodeCount = rootTextNodeIndices.length; for (var i = 0; i < elementBinders.length; i++) { @@ -33,8 +33,7 @@ export class DomProtoView { } // Note: fragments are separated by a comment node that is not counted in fragmentsRootNodeCount! constructor(public type: ViewType, public cloneableTemplate: Element | string, - public encapsulation: ViewEncapsulation, - public elementBinders: List, + public encapsulation: ViewEncapsulation, public elementBinders: DomElementBinder[], public hostAttributes: Map, public rootTextNodeIndices: number[], public boundTextNodeCount: number, public fragmentsRootNodeCount: number[], public isSingleElementFragment: boolean) {} diff --git a/modules/angular2/src/core/render/dom/view/proto_view_builder.ts b/modules/angular2/src/core/render/dom/view/proto_view_builder.ts index 09db14f478..b280705864 100644 --- a/modules/angular2/src/core/render/dom/view/proto_view_builder.ts +++ b/modules/angular2/src/core/render/dom/view/proto_view_builder.ts @@ -4,7 +4,6 @@ import { MapWrapper, Set, SetWrapper, - List, StringMapWrapper } from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; @@ -39,7 +38,7 @@ import {EVENT_TARGET_SEPARATOR} from "../../event_config"; export class ProtoViewBuilder { variableBindings: Map = new Map(); - elements: List = []; + elements: ElementBinderBuilder[] = []; rootTextBindings: Map = new Map(); ngContentCount: number = 0; hostAttributes: Map = new Map(); @@ -153,11 +152,11 @@ export class ProtoViewBuilder { export class ElementBinderBuilder { parent: ElementBinderBuilder = null; distanceToParent: number = 0; - directives: List = []; + directives: DirectiveBuilder[] = []; nestedProtoView: ProtoViewBuilder = null; propertyBindings: Map = new Map(); variableBindings: Map = new Map(); - eventBindings: List = []; + eventBindings: EventBinding[] = []; eventBuilder: EventBuilder = new EventBuilder(); textBindings: Map = new Map(); readAttributes: Map = new Map(); @@ -233,9 +232,9 @@ export class DirectiveBuilder { // mapping from directive property name to AST for that directive propertyBindings: Map = new Map(); // property names used in the template - templatePropertyNames: List = []; + templatePropertyNames: string[] = []; hostPropertyBindings: Map = new Map(); - eventBindings: List = []; + eventBindings: EventBinding[] = []; eventBuilder: EventBuilder = new EventBuilder(); constructor(public directiveIndex: number) {} @@ -259,9 +258,9 @@ export class DirectiveBuilder { } class EventBuilder extends AstTransformer { - locals: List = []; - localEvents: List = []; - globalEvents: List = []; + locals: AST[] = []; + localEvents: Event[] = []; + globalEvents: Event[] = []; _implicitReceiver: AST = new ImplicitReceiver(); constructor() { super(); } @@ -303,19 +302,19 @@ class EventBuilder extends AstTransformer { } } - buildEventLocals(): List { return this.locals; } + buildEventLocals(): AST[] { return this.locals; } - buildLocalEvents(): List { return this.localEvents; } + buildLocalEvents(): Event[] { return this.localEvents; } - buildGlobalEvents(): List { return this.globalEvents; } + buildGlobalEvents(): Event[] { return this.globalEvents; } merge(eventBuilder: EventBuilder) { this._merge(this.localEvents, eventBuilder.localEvents); this._merge(this.globalEvents, eventBuilder.globalEvents); - ListWrapper.concat(this.locals, eventBuilder.locals); + this.locals.concat(eventBuilder.locals); } - _merge(host: List, tobeAdded: List) { + _merge(host: Event[], tobeAdded: Event[]) { var names = []; for (var i = 0; i < host.length; i++) { names.push(host[i].fullName); @@ -336,7 +335,7 @@ const STYLE_PREFIX = 'style'; function buildElementPropertyBindings( schemaRegistry: ElementSchemaRegistry, protoElement: /*element*/ any, isNgComponent: boolean, bindingsInTemplate: Map, directiveTemplatePropertyNames: Set): - List { + ElementPropertyBinding[] { var propertyBindings = []; MapWrapper.forEach(bindingsInTemplate, (ast, propertyNameInTemplate) => { diff --git a/modules/angular2/src/core/render/dom/view/proto_view_merger.ts b/modules/angular2/src/core/render/dom/view/proto_view_merger.ts index 5fad74367c..90fc027b05 100644 --- a/modules/angular2/src/core/render/dom/view/proto_view_merger.ts +++ b/modules/angular2/src/core/render/dom/view/proto_view_merger.ts @@ -25,7 +25,7 @@ import { import {TemplateCloner} from '../template_cloner'; export function mergeProtoViewsRecursively(templateCloner: TemplateCloner, - protoViewRefs: List>): + protoViewRefs: Array): RenderProtoViewMergeMapping { // clone var clonedProtoViews = []; @@ -77,7 +77,7 @@ export function mergeProtoViewsRecursively(templateCloner: TemplateCloner, } function cloneProtoViews( - templateCloner: TemplateCloner, protoViewRefs: List>, + templateCloner: TemplateCloner, protoViewRefs: Array, targetClonedProtoViews: ClonedProtoView[], targetHostViewAndBinderIndices: number[][]) { var hostProtoView = resolveInternalDomProtoView(protoViewRefs[0]); var hostPvIdx = targetClonedProtoViews.length; diff --git a/modules/angular2/src/core/render/dom/view/view.ts b/modules/angular2/src/core/render/dom/view/view.ts index df70150f13..bfb4f5c7c7 100644 --- a/modules/angular2/src/core/render/dom/view/view.ts +++ b/modules/angular2/src/core/render/dom/view/view.ts @@ -1,11 +1,5 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter'; -import { - ListWrapper, - MapWrapper, - Map, - StringMapWrapper, - List -} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, Map, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {isPresent, isBlank, BaseException, stringify} from 'angular2/src/core/facade/lang'; import {DomProtoView} from './proto_view'; @@ -27,9 +21,9 @@ export class DomViewRef extends RenderViewRef { export class DomView { hydrated: boolean = false; eventDispatcher: RenderEventDispatcher = null; - eventHandlerRemovers: List = []; + eventHandlerRemovers: Function[] = []; - constructor(public proto: DomProtoView, public boundTextNodes: List, + constructor(public proto: DomProtoView, public boundTextNodes: Node[], public boundElements: Element[]) {} setElementProperty(elementIndex: number, propertyName: string, value: any) { @@ -65,7 +59,7 @@ export class DomView { } } - invokeElementMethod(elementIndex: number, methodName: string, args: List) { + invokeElementMethod(elementIndex: number, methodName: string, args: any[]) { var element = this.boundElements[elementIndex]; DOM.invoke(element, methodName, args); } diff --git a/modules/angular2/src/core/render/dom/view/view_container.ts b/modules/angular2/src/core/render/dom/view/view_container.ts index de3b9735cd..55cd1fd15e 100644 --- a/modules/angular2/src/core/render/dom/view/view_container.ts +++ b/modules/angular2/src/core/render/dom/view/view_container.ts @@ -1,8 +1,8 @@ -import {ListWrapper, MapWrapper, List} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import * as viewModule from './view'; export class DomViewContainer { // The order in this list matches the DOM order. - views: List = []; + views: Array = []; } diff --git a/modules/angular2/src/core/render/xhr_mock.ts b/modules/angular2/src/core/render/xhr_mock.ts index 6099e96f29..4e0d7a9ff4 100644 --- a/modules/angular2/src/core/render/xhr_mock.ts +++ b/modules/angular2/src/core/render/xhr_mock.ts @@ -1,12 +1,12 @@ import {XHR} from 'angular2/src/core/render/xhr'; -import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; import {isBlank, isPresent, normalizeBlank, BaseException} from 'angular2/src/core/facade/lang'; import {PromiseCompleter, PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; export class MockXHR extends XHR { - private _expectations: List<_Expectation>; + private _expectations: _Expectation[]; private _definitions: Map; - private _requests: List<_PendingRequest>; + private _requests: _PendingRequest[]; constructor() { super(); diff --git a/modules/angular2/src/core/services/url_resolver.ts b/modules/angular2/src/core/services/url_resolver.ts index 7af5dcb7be..5f8bfb649b 100644 --- a/modules/angular2/src/core/services/url_resolver.ts +++ b/modules/angular2/src/core/services/url_resolver.ts @@ -200,7 +200,7 @@ enum _ComponentIndex { * on the browser's regular expression implementation. Never null, since * arbitrary strings may still look like path names. */ -function _split(uri: string): List { +function _split(uri: string): Array { return RegExpWrapper.firstMatch(_splitRe, uri); } @@ -255,7 +255,7 @@ function _removeDotSegments(path: string): string { * @param {Array.} parts * @return {string} */ -function _joinAndCanonicalizePath(parts: List): string { +function _joinAndCanonicalizePath(parts: any[]): string { var path = parts[_ComponentIndex.Path]; path = isBlank(path) ? '' : _removeDotSegments(path); parts[_ComponentIndex.Path] = path; diff --git a/modules/angular2/src/core/testability/get_testability.ts b/modules/angular2/src/core/testability/get_testability.ts index ab98d25761..0ea9dcea88 100644 --- a/modules/angular2/src/core/testability/get_testability.ts +++ b/modules/angular2/src/core/testability/get_testability.ts @@ -8,7 +8,7 @@ class PublicTestability { whenStable(callback: Function) { this._testability.whenStable(callback); } - findBindings(using: any, binding: string, exactMatch: boolean): List { + findBindings(using: any, binding: string, exactMatch: boolean): any[] { return this._testability.findBindings(using, binding, exactMatch); } } @@ -24,7 +24,7 @@ export class GetTestability { } return new PublicTestability(testability); }; - global.getAllAngularTestabilities = function(): List { + global.getAllAngularTestabilities = function(): PublicTestability[] { var testabilities = registry.getAllTestabilities(); return testabilities.map((testability) => { return new PublicTestability(testability); }); }; diff --git a/modules/angular2/src/core/testability/testability.ts b/modules/angular2/src/core/testability/testability.ts index a8a7328696..d94da62271 100644 --- a/modules/angular2/src/core/testability/testability.ts +++ b/modules/angular2/src/core/testability/testability.ts @@ -1,6 +1,6 @@ import {Injectable} from 'angular2/di'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; -import {Map, MapWrapper, List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {Map, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {StringWrapper, isBlank, BaseException} from 'angular2/src/core/facade/lang'; import * as getTestabilityModule from './get_testability'; import {NgZone} from '../zone/ng_zone'; @@ -15,7 +15,7 @@ import {PromiseWrapper} from 'angular2/src/core/facade/async'; @Injectable() export class Testability { _pendingCount: number = 0; - _callbacks: List = []; + _callbacks: Function[] = []; _isAngularEventPending: boolean = false; constructor(public _ngZone: NgZone) { this._watchAngularEvents(_ngZone); } @@ -66,7 +66,7 @@ export class Testability { // check for stability. isAngularEventPending(): boolean { return this._isAngularEventPending; } - findBindings(using: any, binding: string, exactMatch: boolean): List { + findBindings(using: any, binding: string, exactMatch: boolean): any[] { // TODO(juliemr): implement. return []; } @@ -82,7 +82,7 @@ export class TestabilityRegistry { this._applications.set(token, testability); } - getAllTestabilities(): List { return MapWrapper.values(this._applications); } + getAllTestabilities(): Testability[] { return MapWrapper.values(this._applications); } findTestabilityInTree(elem: Node, findInAncestors: boolean = true): Testability { if (elem == null) { diff --git a/modules/angular2/src/core/util/decorators.ts b/modules/angular2/src/core/util/decorators.ts index 0e32683baf..73d78230b9 100644 --- a/modules/angular2/src/core/util/decorators.ts +++ b/modules/angular2/src/core/util/decorators.ts @@ -18,7 +18,7 @@ export interface ClassDefinition { * * See {@link Class} for example of usage. */ - constructor: (Function | Array); + constructor: (Function | any[]); } /** @@ -60,7 +60,7 @@ export interface TypeDecorator { * * Used by {@link Class} to annotate the generated class. */ - annotations: Array; + annotations: any[]; /** * Generate a class from the definition and annotate it with {@link TypeDecorator#annotations}. @@ -76,7 +76,7 @@ function extractAnnotation(annotation: any): any { return annotation; } -function applyParams(fnOrArray: (Function | Array), key: string): Function { +function applyParams(fnOrArray: (Function | any[]), key: string): Function { if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || fnOrArray === Number || fnOrArray === Array) { throw new Error(`Can not use native ${stringify(fnOrArray)} as constructor`); @@ -84,7 +84,7 @@ function applyParams(fnOrArray: (Function | Array), key: string): Function if (isFunction(fnOrArray)) { return fnOrArray; } else if (fnOrArray instanceof Array) { - var annotations: Array = fnOrArray; + var annotations: any[] = fnOrArray; var fn: Function = fnOrArray[fnOrArray.length - 1]; if (!isFunction(fn)) { throw new Error( @@ -95,9 +95,9 @@ function applyParams(fnOrArray: (Function | Array), key: string): Function throw new Error( `Number of annotations (${annoLength}) does not match number of arguments (${fn.length}) in the function: ${stringify(fn)}`); } - var paramsAnnotations: Array> = []; + var paramsAnnotations: any[][] = []; for (var i = 0, ii = annotations.length - 1; i < ii; i++) { - var paramAnnotations: Array = []; + var paramAnnotations: any[] = []; paramsAnnotations.push(paramAnnotations); var annotation = annotations[i]; if (annotation instanceof Array) { @@ -270,7 +270,7 @@ export function makeParamDecorator(annotationCls): any { function ParamDecorator(cls, unusedKey, index): any { - var parameters: Array> = Reflect.getMetadata('parameters', cls); + var parameters: any[][] = Reflect.getMetadata('parameters', cls); parameters = parameters || []; // there might be gaps if some in between parameters do not have annotations. @@ -280,7 +280,7 @@ export function makeParamDecorator(annotationCls): any { } parameters[index] = parameters[index] || []; - var annotationsForParam: Array = parameters[index]; + var annotationsForParam: any[] = parameters[index]; annotationsForParam.push(annotationInstance); Reflect.defineMetadata('parameters', parameters, cls); diff --git a/modules/angular2/src/core/zone/ng_zone.ts b/modules/angular2/src/core/zone/ng_zone.ts index 261a01ecbc..0b7b9e96cf 100644 --- a/modules/angular2/src/core/zone/ng_zone.ts +++ b/modules/angular2/src/core/zone/ng_zone.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {normalizeBlank, isPresent, global} from 'angular2/src/core/facade/lang'; import {wtfLeave, wtfCreateScope, WtfScopeFn} from '../profile/profile'; @@ -45,7 +45,7 @@ export class NgZone { _inVmTurnDone: boolean = false; - _pendingTimeouts: List = []; + _pendingTimeouts: number[] = []; /** * Associates with this diff --git a/modules/angular2/src/forms/directives.ts b/modules/angular2/src/forms/directives.ts index 83c5dfe651..d21cc35497 100644 --- a/modules/angular2/src/forms/directives.ts +++ b/modules/angular2/src/forms/directives.ts @@ -35,7 +35,7 @@ export {NgValidator, NgRequiredValidator} from './directives/validators'; * * This is a shorthand for importing them each individually. */ -export const FORM_DIRECTIVES: List = CONST_EXPR([ +export const FORM_DIRECTIVES: Type[] = CONST_EXPR([ NgControlName, NgControlGroup, diff --git a/modules/angular2/src/forms/directives/control_container.ts b/modules/angular2/src/forms/directives/control_container.ts index eb1896b5c3..62a41b8983 100644 --- a/modules/angular2/src/forms/directives/control_container.ts +++ b/modules/angular2/src/forms/directives/control_container.ts @@ -1,6 +1,5 @@ import {Form} from './form_interface'; import {AbstractControlDirective} from './abstract_control_directive'; -import {List} from 'angular2/src/core/facade/collection'; /** * A directive that contains a group of [NgControl]. @@ -10,5 +9,5 @@ import {List} from 'angular2/src/core/facade/collection'; export class ControlContainer extends AbstractControlDirective { name: string; get formDirective(): Form { return null; } - get path(): List { return null; } + get path(): string[] { return null; } } diff --git a/modules/angular2/src/forms/directives/ng_control.ts b/modules/angular2/src/forms/directives/ng_control.ts index 68b185bf3e..bd8916edc9 100644 --- a/modules/angular2/src/forms/directives/ng_control.ts +++ b/modules/angular2/src/forms/directives/ng_control.ts @@ -11,7 +11,7 @@ export class NgControl extends AbstractControlDirective { valueAccessor: ControlValueAccessor = null; get validator(): Function { return null; } - get path(): List { return null; } + get path(): string[] { return null; } viewToModelUpdate(newValue: any): void {} } diff --git a/modules/angular2/src/forms/directives/ng_control_group.ts b/modules/angular2/src/forms/directives/ng_control_group.ts index 9b5e6c3001..6506e1b75d 100644 --- a/modules/angular2/src/forms/directives/ng_control_group.ts +++ b/modules/angular2/src/forms/directives/ng_control_group.ts @@ -1,6 +1,6 @@ import {Directive, LifecycleEvent} from 'angular2/metadata'; import {Inject, Host, SkipSelf, forwardRef, Binding} from 'angular2/di'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {CONST_EXPR} from 'angular2/src/core/facade/lang'; import {ControlContainer} from './control_container'; @@ -68,7 +68,7 @@ export class NgControlGroup extends ControlContainer { get control(): ControlGroup { return this.formDirective.getControlGroup(this); } - get path(): List { return controlPath(this.name, this._parent); } + get path(): string[] { return controlPath(this.name, this._parent); } get formDirective(): Form { return this._parent.formDirective; } } diff --git a/modules/angular2/src/forms/directives/ng_control_name.ts b/modules/angular2/src/forms/directives/ng_control_name.ts index 8dbc19e07a..e533ccf6b7 100644 --- a/modules/angular2/src/forms/directives/ng_control_name.ts +++ b/modules/angular2/src/forms/directives/ng_control_name.ts @@ -1,6 +1,6 @@ import {CONST_EXPR} from 'angular2/src/core/facade/lang'; import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {List, StringMap} from 'angular2/src/core/facade/collection'; +import {StringMap} from 'angular2/src/core/facade/collection'; import {QueryList} from 'angular2/core'; import {Query, Directive, LifecycleEvent} from 'angular2/metadata'; @@ -113,7 +113,7 @@ export class NgControlName extends NgControl { ObservableWrapper.callNext(this.update, newValue); } - get path(): List { return controlPath(this.name, this._parent); } + get path(): string[] { return controlPath(this.name, this._parent); } get formDirective(): any { return this._parent.formDirective; } diff --git a/modules/angular2/src/forms/directives/ng_form.ts b/modules/angular2/src/forms/directives/ng_form.ts index d6fa27d6b7..c8ef4cf60b 100644 --- a/modules/angular2/src/forms/directives/ng_form.ts +++ b/modules/angular2/src/forms/directives/ng_form.ts @@ -4,7 +4,7 @@ import { EventEmitter, PromiseCompleter } from 'angular2/src/core/facade/async'; -import {StringMapWrapper, List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {isPresent, isBlank, CONST_EXPR} from 'angular2/src/core/facade/lang'; import {Directive} from 'angular2/metadata'; import {forwardRef, Binding} from 'angular2/di'; @@ -72,7 +72,7 @@ export class NgForm extends ControlContainer implements Form { get control(): ControlGroup { return this.form; } - get path(): List { return []; } + get path(): string[] { return []; } get controls(): StringMap { return this.form.controls; } @@ -133,7 +133,7 @@ export class NgForm extends ControlContainer implements Form { return false; } - _findContainer(path: List): ControlGroup { + _findContainer(path: string[]): ControlGroup { ListWrapper.removeLast(path); return ListWrapper.isEmpty(path) ? this.form : this.form.find(path); } diff --git a/modules/angular2/src/forms/directives/ng_form_control.ts b/modules/angular2/src/forms/directives/ng_form_control.ts index e8d2930015..587a3b9be4 100644 --- a/modules/angular2/src/forms/directives/ng_form_control.ts +++ b/modules/angular2/src/forms/directives/ng_form_control.ts @@ -91,7 +91,7 @@ export class NgFormControl extends NgControl { } } - get path(): List { return []; } + get path(): string[] { return []; } get control(): Control { return this.form; } diff --git a/modules/angular2/src/forms/directives/ng_form_model.ts b/modules/angular2/src/forms/directives/ng_form_model.ts index 89a0824c89..1f3267672d 100644 --- a/modules/angular2/src/forms/directives/ng_form_model.ts +++ b/modules/angular2/src/forms/directives/ng_form_model.ts @@ -1,5 +1,5 @@ import {CONST_EXPR} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {ObservableWrapper, EventEmitter} from 'angular2/src/core/facade/async'; import {Directive, LifecycleEvent} from 'angular2/metadata'; @@ -93,7 +93,7 @@ const formDirectiveBinding = }) export class NgFormModel extends ControlContainer implements Form { form: ControlGroup = null; - directives: List = []; + directives: NgControl[] = []; ngSubmit = new EventEmitter(); onChanges(_) { this._updateDomValue(); } @@ -102,7 +102,7 @@ export class NgFormModel extends ControlContainer implements Form { get control(): ControlGroup { return this.form; } - get path(): List { return []; } + get path(): string[] { return []; } addControl(dir: NgControl): void { var c: any = this.form.find(dir.path); diff --git a/modules/angular2/src/forms/directives/ng_model.ts b/modules/angular2/src/forms/directives/ng_model.ts index f564deebc3..16337ecde3 100644 --- a/modules/angular2/src/forms/directives/ng_model.ts +++ b/modules/angular2/src/forms/directives/ng_model.ts @@ -64,7 +64,7 @@ export class NgModel extends NgControl { get control(): Control { return this._control; } - get path(): List { return []; } + get path(): string[] { return []; } get validator(): Function { return composeNgValidator(this.ngValidators); } diff --git a/modules/angular2/src/forms/form_builder.ts b/modules/angular2/src/forms/form_builder.ts index ccdcbce183..40bb613d90 100644 --- a/modules/angular2/src/forms/form_builder.ts +++ b/modules/angular2/src/forms/form_builder.ts @@ -1,5 +1,5 @@ import {Injectable} from 'angular2/di'; -import {StringMapWrapper, ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {isPresent, isArray} from 'angular2/src/core/facade/lang'; import * as modelModule from './model'; @@ -91,7 +91,7 @@ export class FormBuilder { } } - array(controlsConfig: List, validator: Function = null): modelModule.ControlArray { + array(controlsConfig: any[], validator: Function = null): modelModule.ControlArray { var controls = ListWrapper.map(controlsConfig, (c) => this._createControl(c)); if (isPresent(validator)) { return new modelModule.ControlArray(controls, validator); @@ -115,7 +115,7 @@ export class FormBuilder { return controlConfig; } else if (isArray(controlConfig)) { - var value = ListWrapper.get(controlConfig, 0); + var value = controlConfig[0]; var validator = controlConfig.length > 1 ? controlConfig[1] : null; return this.control(value, validator); diff --git a/modules/angular2/src/forms/model.ts b/modules/angular2/src/forms/model.ts index a3a742c57d..fbd438956c 100644 --- a/modules/angular2/src/forms/model.ts +++ b/modules/angular2/src/forms/model.ts @@ -1,6 +1,6 @@ import {StringWrapper, isPresent, isBlank} from 'angular2/src/core/facade/lang'; import {Observable, EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {StringMap, StringMapWrapper, ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {StringMap, StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {Validators} from './validators'; /** @@ -17,14 +17,14 @@ export function isControl(c: Object): boolean { return c instanceof AbstractControl; } -function _find(c: AbstractControl, path: List| string) { +function _find(c: AbstractControl, path: Array| string) { if (isBlank(path)) return null; - if (!(path instanceof List)) { + if (!(path instanceof Array)) { path = StringWrapper.split(path, new RegExp("/")); } - if (path instanceof List && ListWrapper.isEmpty(path)) return null; + if (path instanceof Array && ListWrapper.isEmpty(path)) return null; - return ListWrapper.reduce(>path, (v, name) => { + return ListWrapper.reduce(>path, (v, name) => { if (v instanceof ControlGroup) { return isPresent(v.controls[name]) ? v.controls[name] : null; } else if (v instanceof ControlArray) { @@ -116,9 +116,9 @@ export class AbstractControl { } } - find(path: List| string): AbstractControl { return _find(this, path); } + find(path: Array| string): AbstractControl { return _find(this, path); } - getError(errorCode: string, path: List = null): any { + getError(errorCode: string, path: string[] = null): any { var c = isPresent(path) && !ListWrapper.isEmpty(path) ? this.find(path) : this; if (isPresent(c) && isPresent(c._errors)) { return StringMapWrapper.get(c._errors, errorCode); @@ -127,7 +127,7 @@ export class AbstractControl { } } - hasError(errorCode: string, path: List = null): boolean { + hasError(errorCode: string, path: string[] = null): boolean { return isPresent(this.getError(errorCode, path)); } @@ -183,8 +183,8 @@ export class ControlGroup extends AbstractControl { controls: StringMap; _optionals: StringMap; - constructor(controls: StringMap, - optionals: StringMap = null, + constructor(controls: StringMap, + optionals: StringMap = null, validator: Function = Validators.group) { super(validator); this.controls = controls; @@ -262,9 +262,9 @@ export class ControlGroup extends AbstractControl { * other controls, but is of fixed length. */ export class ControlArray extends AbstractControl { - controls: List; + controls: AbstractControl[]; - constructor(controls: List, validator: Function = Validators.array) { + constructor(controls: AbstractControl[], validator: Function = Validators.array) { super(validator); this.controls = controls; diff --git a/modules/angular2/src/forms/validators.ts b/modules/angular2/src/forms/validators.ts index 418a72f682..74eb68b9c2 100644 --- a/modules/angular2/src/forms/validators.ts +++ b/modules/angular2/src/forms/validators.ts @@ -1,5 +1,5 @@ import {isBlank, isPresent} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import * as modelModule from './model'; @@ -19,7 +19,7 @@ export class Validators { static nullValidator(c: any): StringMap { return null; } - static compose(validators: List): Function { + static compose(validators: Function[]): Function { return function(c: modelModule.Control) { var res = ListWrapper.reduce(validators, (res, validator) => { var errors = validator(c); diff --git a/modules/angular2/src/http/backends/mock_backend.ts b/modules/angular2/src/http/backends/mock_backend.ts index 6a155f9f98..94ad145a55 100644 --- a/modules/angular2/src/http/backends/mock_backend.ts +++ b/modules/angular2/src/http/backends/mock_backend.ts @@ -170,7 +170,7 @@ export class MockBackend implements ConnectionBackend { * * This property only exists in the mock implementation, not in real Backends. */ - connectionsArray: Array; + connectionsArray: MockConnection[]; /** * {@link EventEmitter} of {@link MockConnection} instances that haven't yet been resolved (i.e. * with a `readyState` diff --git a/modules/angular2/src/http/headers.ts b/modules/angular2/src/http/headers.ts index f72ecf848f..68771778b8 100644 --- a/modules/angular2/src/http/headers.ts +++ b/modules/angular2/src/http/headers.ts @@ -8,7 +8,6 @@ import { } from 'angular2/src/core/facade/lang'; import { isListLikeIterable, - List, Map, MapWrapper, ListWrapper, @@ -21,7 +20,7 @@ import { * difference from the spec is the lack of an `entries` method. */ export class Headers { - _headersMap: Map>; + _headersMap: Map; constructor(headers?: Headers | StringMap) { if (isBlank(headers)) { this._headersMap = new Map(); @@ -31,7 +30,7 @@ export class Headers { if (headers instanceof Headers) { this._headersMap = (headers)._headersMap; } else if (headers instanceof StringMap) { - this._headersMap = MapWrapper.createFromStringMap>(headers); + this._headersMap = MapWrapper.createFromStringMap(headers); MapWrapper.forEach(this._headersMap, (v, k) => { if (!isListLikeIterable(v)) { var list = []; @@ -72,16 +71,16 @@ export class Headers { /** * Provides names of set headers */ - keys(): List { return MapWrapper.keys(this._headersMap); } + keys(): string[] { return MapWrapper.keys(this._headersMap); } /** * Sets or overrides header value for given name. */ - set(header: string, value: string | List): void { + set(header: string, value: string | string[]): void { var list = []; if (isListLikeIterable(value)) { - var pushValue = (>value).join(','); + var pushValue = (value).join(','); list.push(pushValue); } else { list.push(value); @@ -93,12 +92,12 @@ export class Headers { /** * Returns values of all headers. */ - values(): List> { return MapWrapper.values(this._headersMap); } + values(): string[][] { return MapWrapper.values(this._headersMap); } /** * Returns list of header values for a given name. */ - getAll(header: string): Array { + getAll(header: string): string[] { var headers = this._headersMap.get(header); return isListLikeIterable(headers) ? headers : []; } diff --git a/modules/angular2/src/http/url_search_params.ts b/modules/angular2/src/http/url_search_params.ts index 3696d9a167..9743a88ee7 100644 --- a/modules/angular2/src/http/url_search_params.ts +++ b/modules/angular2/src/http/url_search_params.ts @@ -2,19 +2,18 @@ import {CONST_EXPR, isPresent, isBlank, StringWrapper} from 'angular2/src/core/f import { Map, MapWrapper, - List, ListWrapper, isListLikeIterable } from 'angular2/src/core/facade/collection'; -function paramParser(rawParams: string = ''): Map> { - var map: Map> = new Map(); +function paramParser(rawParams: string = ''): Map { + var map: Map = new Map(); if (rawParams.length > 0) { - var params: List = StringWrapper.split(rawParams, new RegExp('&')); + var params: string[] = StringWrapper.split(rawParams, new RegExp('&')); ListWrapper.forEach(params, (param: string) => { - var split: List = StringWrapper.split(param, new RegExp('=')); - var key = ListWrapper.get(split, 0); - var val = ListWrapper.get(split, 1); + var split: string[] = StringWrapper.split(param, new RegExp('=')); + var key = split[0]; + var val = split[1]; var list = isPresent(map.get(key)) ? map.get(key) : []; list.push(val); map.set(key, list); @@ -35,7 +34,7 @@ export const URLSearchParamsUnionFixer: string = CONST_EXPR("UnionFixer"); * - replaceAll() */ export class URLSearchParams { - paramsMap: Map>; + paramsMap: Map; constructor(public rawParams: string = '') { this.paramsMap = paramParser(rawParams); } clone(): URLSearchParams { @@ -55,7 +54,7 @@ export class URLSearchParams { } } - getAll(param: string): List { + getAll(param: string): string[] { var mapParam = this.paramsMap.get(param); return isPresent(mapParam) ? mapParam : []; } diff --git a/modules/angular2/src/mock/location_mock.ts b/modules/angular2/src/mock/location_mock.ts index 0d38a928ec..3c423ccaa3 100644 --- a/modules/angular2/src/mock/location_mock.ts +++ b/modules/angular2/src/mock/location_mock.ts @@ -1,9 +1,9 @@ import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Location} from 'angular2/src/router/location'; export class SpyLocation implements Location { - urlChanges: List = []; + urlChanges: string[] = []; _path: string = ''; _subject: EventEmitter = new EventEmitter(); _baseHref: string = ''; diff --git a/modules/angular2/src/mock/mock_location_strategy.ts b/modules/angular2/src/mock/mock_location_strategy.ts index 8387c60a21..dd1b5f74ec 100644 --- a/modules/angular2/src/mock/mock_location_strategy.ts +++ b/modules/angular2/src/mock/mock_location_strategy.ts @@ -1,5 +1,4 @@ import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; -import {List} from 'angular2/src/core/facade/collection'; import {LocationStrategy} from 'angular2/src/router/location_strategy'; @@ -7,7 +6,7 @@ export class MockLocationStrategy extends LocationStrategy { internalBaseHref: string = '/'; internalPath: string = '/'; internalTitle: string = ''; - urlChanges: List = []; + urlChanges: string[] = []; _subject: EventEmitter = new EventEmitter(); constructor() { super(); } diff --git a/modules/angular2/src/router/instruction.ts b/modules/angular2/src/router/instruction.ts index f669d23332..101d67e716 100644 --- a/modules/angular2/src/router/instruction.ts +++ b/modules/angular2/src/router/instruction.ts @@ -3,7 +3,6 @@ import { MapWrapper, StringMap, StringMapWrapper, - List, ListWrapper } from 'angular2/src/core/facade/collection'; import {isPresent, isBlank, normalizeBlank, Type} from 'angular2/src/core/facade/lang'; @@ -42,7 +41,7 @@ export class Instruction { */ export class PrimaryInstruction { constructor(public component: ComponentInstruction, public child: PrimaryInstruction, - public auxUrls: List) {} + public auxUrls: Url[]) {} } export function stringifyInstruction(instruction: Instruction): string { @@ -93,7 +92,7 @@ function stringifyAux(instruction: Instruction): string { export class ComponentInstruction { reuse: boolean = false; - constructor(public urlPath: string, public urlParams: List, + constructor(public urlPath: string, public urlParams: string[], private _recognizer: PathRecognizer, public params: StringMap = null) {} get componentType() { return this._recognizer.handler.componentType; } diff --git a/modules/angular2/src/router/path_recognizer.ts b/modules/angular2/src/router/path_recognizer.ts index 7b7757d2f9..42d32e3069 100644 --- a/modules/angular2/src/router/path_recognizer.ts +++ b/modules/angular2/src/router/path_recognizer.ts @@ -12,7 +12,6 @@ import { MapWrapper, StringMap, StringMapWrapper, - List, ListWrapper } from 'angular2/src/core/facade/collection'; @@ -149,7 +148,7 @@ function parsePathString(route: string): StringMap { // this function is used to determine whether a route config path like `/foo/:id` collides with // `/foo/:name` -function pathDslHash(segments: List): string { +function pathDslHash(segments: Segment[]): string { return segments.map((segment) => { if (segment instanceof StarSegment) { return '*'; @@ -164,7 +163,7 @@ function pathDslHash(segments: List): string { .join('/'); } -function splitBySlash(url: string): List { +function splitBySlash(url: string): string[] { return url.split('/'); } @@ -183,12 +182,12 @@ function assertPath(path: string) { export class PathMatch { constructor(public instruction: ComponentInstruction, public remaining: Url, - public remainingAux: List) {} + public remainingAux: Url[]) {} } // represents something like '/foo/:bar' export class PathRecognizer { - private _segments: List; + private _segments: Segment[]; specificity: number; terminal: boolean = true; hash: string; @@ -297,7 +296,7 @@ export class PathRecognizer { return this._getInstruction(urlPath, urlParams, this, params); } - private _getInstruction(urlPath: string, urlParams: List, _recognizer: PathRecognizer, + private _getInstruction(urlPath: string, urlParams: string[], _recognizer: PathRecognizer, params: StringMap): ComponentInstruction { var hashKey = urlPath + '?' + urlParams.join('?'); if (this.cache.has(hashKey)) { diff --git a/modules/angular2/src/router/pipeline.ts b/modules/angular2/src/router/pipeline.ts index 28c3f88596..49159655f2 100644 --- a/modules/angular2/src/router/pipeline.ts +++ b/modules/angular2/src/router/pipeline.ts @@ -1,5 +1,5 @@ import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Instruction} from './instruction'; import {Injectable} from 'angular2/di'; @@ -9,7 +9,7 @@ import {Injectable} from 'angular2/di'; */ @Injectable() export class Pipeline { - steps: List; + steps: Function[]; constructor() { this.steps = [instruction => instruction.router.activateOutlets(instruction)]; } diff --git a/modules/angular2/src/router/route_config_decorator.ts b/modules/angular2/src/router/route_config_decorator.ts index 6d5a833498..bfac76e4b8 100644 --- a/modules/angular2/src/router/route_config_decorator.ts +++ b/modules/angular2/src/router/route_config_decorator.ts @@ -1,7 +1,6 @@ import {RouteConfig as RouteConfigAnnotation, RouteDefinition} from './route_config_impl'; import {makeDecorator} from 'angular2/src/core/util/decorators'; -import {List} from 'angular2/src/core/facade/collection'; export {Route, Redirect, AuxRoute, AsyncRoute, RouteDefinition} from './route_config_impl'; -export var RouteConfig: (configs: List) => ClassDecorator = +export var RouteConfig: (configs: RouteDefinition[]) => ClassDecorator = makeDecorator(RouteConfigAnnotation); diff --git a/modules/angular2/src/router/route_config_impl.ts b/modules/angular2/src/router/route_config_impl.ts index b828a0052d..93ae1bb844 100644 --- a/modules/angular2/src/router/route_config_impl.ts +++ b/modules/angular2/src/router/route_config_impl.ts @@ -1,5 +1,4 @@ import {CONST, Type} from 'angular2/src/core/facade/lang'; -import {List} from 'angular2/src/core/facade/collection'; import {RouteDefinition} from './route_definition'; export {RouteDefinition} from './route_definition'; @@ -14,7 +13,7 @@ export {RouteDefinition} from './route_definition'; */ @CONST() export class RouteConfig { - constructor(public configs: List) {} + constructor(public configs: RouteDefinition[]) {} } diff --git a/modules/angular2/src/router/route_recognizer.ts b/modules/angular2/src/router/route_recognizer.ts index b97ed4d3ec..9eb0ce537e 100644 --- a/modules/angular2/src/router/route_recognizer.ts +++ b/modules/angular2/src/router/route_recognizer.ts @@ -12,7 +12,6 @@ import { import { Map, MapWrapper, - List, ListWrapper, StringMap, StringMapWrapper @@ -37,10 +36,10 @@ export class RouteRecognizer { auxRoutes: Map = new Map(); // TODO: optimize this into a trie - matchers: List = []; + matchers: PathRecognizer[] = []; // TODO: optimize this into a trie - redirects: List = []; + redirects: Redirector[] = []; config(config: RouteDefinition): boolean { var handler; @@ -83,7 +82,7 @@ export class RouteRecognizer { * Given a URL, returns a list of `RouteMatch`es, which are partial recognitions for some route. * */ - recognize(urlParse: Url): List { + recognize(urlParse: Url): PathMatch[] { var solutions = []; urlParse = this._redirect(urlParse); @@ -131,8 +130,8 @@ export class RouteRecognizer { } export class Redirector { - segments: List = []; - toSegments: List = []; + segments: string[] = []; + toSegments: string[] = []; constructor(path: string, redirectTo: string) { if (path.startsWith('/')) { diff --git a/modules/angular2/src/router/route_registry.ts b/modules/angular2/src/router/route_registry.ts index 4ff02aa2d6..a08e11c94d 100644 --- a/modules/angular2/src/router/route_registry.ts +++ b/modules/angular2/src/router/route_registry.ts @@ -2,7 +2,6 @@ import {PathMatch} from './path_recognizer'; import {RouteRecognizer} from './route_recognizer'; import {Instruction, ComponentInstruction, PrimaryInstruction} from './instruction'; import { - List, ListWrapper, Map, MapWrapper, @@ -198,7 +197,7 @@ export class RouteRegistry { * Given a normalized list with component names and params like: `['user', {id: 3 }]` * generates a url with a leading slash relative to the provided `parentComponent`. */ - generate(linkParams: List, parentComponent: any): Instruction { + generate(linkParams: any[], parentComponent: any): Instruction { let segments = []; let componentCursor = parentComponent; @@ -283,7 +282,7 @@ export class RouteRegistry { /* * Given a list of instructions, returns the most specific instruction */ -function mostSpecific(instructions: List): PrimaryInstruction { +function mostSpecific(instructions: PrimaryInstruction[]): PrimaryInstruction { return ListWrapper.maximum( instructions, (instruction: PrimaryInstruction) => instruction.component.specificity); } diff --git a/modules/angular2/src/router/router.ts b/modules/angular2/src/router/router.ts index 050ad37648..436d4a1fab 100644 --- a/modules/angular2/src/router/router.ts +++ b/modules/angular2/src/router/router.ts @@ -4,13 +4,7 @@ import { EventEmitter, ObservableWrapper } from 'angular2/src/core/facade/async'; -import { - Map, - StringMapWrapper, - MapWrapper, - List, - ListWrapper -} from 'angular2/src/core/facade/collection'; +import {Map, StringMapWrapper, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import { isBlank, isString, @@ -153,7 +147,7 @@ export class Router { * ]); * ``` */ - config(definitions: List): Promise { + config(definitions: RouteDefinition[]): Promise { definitions.forEach( (routeDefinition) => { this.registry.config(this.hostComponent, routeDefinition); }); return this.renavigate(); @@ -222,7 +216,7 @@ export class Router { // we begin navigation. The method below simply traverses instructions and resolves any components // for which `componentType` is not present _settleInstruction(instruction: Instruction): Promise { - var unsettledInstructions: List> = []; + var unsettledInstructions: Array> = []; if (isBlank(instruction.component.componentType)) { unsettledInstructions.push(instruction.component.resolveComponentType()); } @@ -387,7 +381,7 @@ export class Router { * Generate a URL from a component name and optional map of parameters. The URL is relative to the * app's base href. */ - generate(linkParams: List): Instruction { + generate(linkParams: any[]): Instruction { let normalizedLinkParams = splitAndFlattenLinkParams(linkParams); var first = ListWrapper.first(normalizedLinkParams); @@ -494,10 +488,10 @@ class ChildRouter extends Router { * Returns: ['', 'a', 'b', {c: 2}] */ var SLASH = new RegExp('/'); -function splitAndFlattenLinkParams(linkParams: List): List { +function splitAndFlattenLinkParams(linkParams: any[]): any[] { return ListWrapper.reduce(linkParams, (accumulation, item) => { if (isString(item)) { - return ListWrapper.concat(accumulation, StringWrapper.split(item, SLASH)); + return accumulation.concat(StringWrapper.split(item, SLASH)); } accumulation.push(item); return accumulation; diff --git a/modules/angular2/src/router/router_link.ts b/modules/angular2/src/router/router_link.ts index e89920c5a3..4fbd50fd54 100644 --- a/modules/angular2/src/router/router_link.ts +++ b/modules/angular2/src/router/router_link.ts @@ -1,5 +1,5 @@ import {Directive} from '../core/metadata'; -import {List, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {Router} from './router'; import {Location} from './location'; @@ -44,7 +44,7 @@ import {Instruction, stringifyInstruction} from './instruction'; } }) export class RouterLink { - private _routeParams: List; + private _routeParams: any[]; // the url displayed on the anchor element. visibleHref: string; @@ -56,7 +56,7 @@ export class RouterLink { get isRouteActive(): boolean { return this._router.isRouteActive(this._navigationInstruction); } - set routeParams(changes: List) { + set routeParams(changes: any[]) { this._routeParams = changes; this._navigationInstruction = this._router.generate(this._routeParams); diff --git a/modules/angular2/src/router/url_parser.ts b/modules/angular2/src/router/url_parser.ts index ec54a34657..85b004e6e0 100644 --- a/modules/angular2/src/router/url_parser.ts +++ b/modules/angular2/src/router/url_parser.ts @@ -1,4 +1,4 @@ -import {List, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection'; import { isPresent, isBlank, @@ -12,7 +12,7 @@ import { */ export class Url { constructor(public path: string, public child: Url = null, - public auxiliary: List = CONST_EXPR([]), + public auxiliary: Url[] = CONST_EXPR([]), public params: StringMap = null) {} toString(): string { @@ -39,7 +39,7 @@ export class Url { } export class RootUrl extends Url { - constructor(path: string, child: Url = null, auxiliary: List = CONST_EXPR([]), + constructor(path: string, child: Url = null, auxiliary: Url[] = CONST_EXPR([]), params: StringMap = null) { super(path, child, auxiliary, params); } @@ -59,7 +59,7 @@ export class RootUrl extends Url { } } -export function pathSegmentsToUrl(pathSegments: List): Url { +export function pathSegmentsToUrl(pathSegments: string[]): Url { var url = new Url(pathSegments[pathSegments.length - 1]); for (var i = pathSegments.length - 2; i >= 0; i -= 1) { url = new Url(pathSegments[i], url); @@ -187,7 +187,7 @@ export class UrlParser { params[key] = value; } - parseAuxiliaryRoutes(): List { + parseAuxiliaryRoutes(): Url[] { var routes = []; this.capture('('); @@ -205,7 +205,7 @@ export class UrlParser { export var parser = new UrlParser(); -export function serializeParams(paramMap: StringMap): List { +export function serializeParams(paramMap: StringMap): string[] { var params = []; if (isPresent(paramMap)) { StringMapWrapper.forEach(paramMap, (value, key) => { diff --git a/modules/angular2/src/test_lib/fake_async.ts b/modules/angular2/src/test_lib/fake_async.ts index c19b6e3d38..0ce8327380 100644 --- a/modules/angular2/src/test_lib/fake_async.ts +++ b/modules/angular2/src/test_lib/fake_async.ts @@ -5,9 +5,9 @@ import {ListWrapper} from 'angular2/src/core/facade/collection'; import {NgZoneZone} from 'angular2/src/core/zone/ng_zone'; var _scheduler; -var _microtasks: List = []; -var _pendingPeriodicTimers: List = []; -var _pendingTimers: List = []; +var _microtasks: Function[] = []; +var _pendingPeriodicTimers: number[] = []; +var _pendingTimers: number[] = []; var _error = null; interface FakeAsyncZone extends NgZoneZone { diff --git a/modules/angular2/src/test_lib/lang_utils.ts b/modules/angular2/src/test_lib/lang_utils.ts index cb4fbfa1ee..a6fdea6267 100644 --- a/modules/angular2/src/test_lib/lang_utils.ts +++ b/modules/angular2/src/test_lib/lang_utils.ts @@ -2,7 +2,7 @@ export function getTypeOf(instance) { return instance.constructor; } -export function instantiateType(type: Function, params: Array = []) { +export function instantiateType(type: Function, params: any[] = []) { var instance = Object.create(type.prototype); instance.constructor.apply(instance, params); return instance; diff --git a/modules/angular2/src/test_lib/test_component_builder.ts b/modules/angular2/src/test_lib/test_component_builder.ts index 95c4ad2c11..8379201d0d 100644 --- a/modules/angular2/src/test_lib/test_component_builder.ts +++ b/modules/angular2/src/test_lib/test_component_builder.ts @@ -2,7 +2,7 @@ import {Injector, bind, Injectable} from 'angular2/di'; import {Type, isPresent, BaseException, isBlank} from 'angular2/src/core/facade/lang'; import {Promise} from 'angular2/src/core/facade/async'; -import {List, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import {ViewMetadata} from '../core/metadata'; diff --git a/modules/angular2/src/test_lib/test_injector.ts b/modules/angular2/src/test_lib/test_injector.ts index f1016062b4..4728cbff52 100644 --- a/modules/angular2/src/test_lib/test_injector.ts +++ b/modules/angular2/src/test_lib/test_injector.ts @@ -42,7 +42,7 @@ import {TestComponentBuilder} from './test_component_builder'; import {Injector} from 'angular2/di'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {FunctionWrapper, Type} from 'angular2/src/core/facade/lang'; import {AppViewPool, APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool'; @@ -156,7 +156,7 @@ function _getAppBindings() { ]; } -export function createTestInjector(bindings: List>): Injector { +export function createTestInjector(bindings: Array): Injector { var rootInjector = Injector.resolveAndCreate(_getRootBindings()); return rootInjector.resolveAndCreateChild(ListWrapper.concat(_getAppBindings(), bindings)); } @@ -190,15 +190,15 @@ export function createTestInjector(bindings: List>): * @param {Function} fn * @return {FunctionWithParamTokens} */ -export function inject(tokens: List, fn: Function): FunctionWithParamTokens { +export function inject(tokens: any[], fn: Function): FunctionWithParamTokens { return new FunctionWithParamTokens(tokens, fn); } export class FunctionWithParamTokens { - _tokens: List; + _tokens: any[]; _fn: Function; - constructor(tokens: List, fn: Function) { + constructor(tokens: any[], fn: Function) { this._tokens = tokens; this._fn = fn; } diff --git a/modules/angular2/src/test_lib/test_lib.ts b/modules/angular2/src/test_lib/test_lib.ts index 7119b08e58..88f51c7b38 100644 --- a/modules/angular2/src/test_lib/test_lib.ts +++ b/modules/angular2/src/test_lib/test_lib.ts @@ -55,7 +55,7 @@ var inIt = false; var testBindings; class BeforeEachRunner { - _fns: List; + _fns: FunctionWithParamTokens[]; _parent: BeforeEachRunner; constructor(parent: BeforeEachRunner) { this._fns = []; diff --git a/modules/angular2/src/test_lib/utils.ts b/modules/angular2/src/test_lib/utils.ts index 1cf150da39..6baa3ab309 100644 --- a/modules/angular2/src/test_lib/utils.ts +++ b/modules/angular2/src/test_lib/utils.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import { isPresent, @@ -9,7 +9,7 @@ import { } from 'angular2/src/core/facade/lang'; export class Log { - _result: List; + _result: any[]; constructor() { this._result = []; } diff --git a/modules/angular2/src/web_workers/shared/client_message_broker.ts b/modules/angular2/src/web_workers/shared/client_message_broker.ts index ede2897b4d..90702b603b 100644 --- a/modules/angular2/src/web_workers/shared/client_message_broker.ts +++ b/modules/angular2/src/web_workers/shared/client_message_broker.ts @@ -132,5 +132,5 @@ export class FnArg { } export class UiArguments { - constructor(public method: string, public args?: List) {} + constructor(public method: string, public args?: FnArg[]) {} } diff --git a/modules/angular2/src/web_workers/shared/render_view_with_fragments_store.ts b/modules/angular2/src/web_workers/shared/render_view_with_fragments_store.ts index 49ef5de9ae..6f04b17aaa 100644 --- a/modules/angular2/src/web_workers/shared/render_view_with_fragments_store.ts +++ b/modules/angular2/src/web_workers/shared/render_view_with_fragments_store.ts @@ -5,7 +5,7 @@ import { RenderViewWithFragments } from "angular2/src/core/render/api"; import {ON_WEB_WORKER} from "angular2/src/web_workers/shared/api"; -import {List, MapWrapper, ListWrapper} from "angular2/src/core/facade/collection"; +import {MapWrapper, ListWrapper} from "angular2/src/core/facade/collection"; @Injectable() export class RenderViewWithFragmentsStore { @@ -13,13 +13,13 @@ export class RenderViewWithFragmentsStore { private _onWebWorker: boolean; private _lookupByIndex: Map; private _lookupByView: Map; - private _viewFragments: Map>; + private _viewFragments: Map; constructor(@Inject(ON_WEB_WORKER) onWebWorker) { this._onWebWorker = onWebWorker; this._lookupByIndex = new Map(); this._lookupByView = new Map(); - this._viewFragments = new Map>(); + this._viewFragments = new Map(); } allocate(fragmentCount: number): RenderViewWithFragments { diff --git a/modules/angular2/src/web_workers/shared/serializer.ts b/modules/angular2/src/web_workers/shared/serializer.ts index 0dfc5ec66e..249fd9cbdc 100644 --- a/modules/angular2/src/web_workers/shared/serializer.ts +++ b/modules/angular2/src/web_workers/shared/serializer.ts @@ -7,7 +7,6 @@ import { BaseException } from "angular2/src/core/facade/lang"; import { - List, ListWrapper, Map, StringMap, @@ -119,7 +118,7 @@ export class Serializer { return null; } if (isArray(map)) { - var obj: List = new List(); + var obj: any[] = []; ListWrapper.forEach(map, (val) => { obj.push(this.deserialize(val, type, data)); }); return obj; } diff --git a/modules/angular2/src/web_workers/shared/service_message_broker.ts b/modules/angular2/src/web_workers/shared/service_message_broker.ts index a9472d8b12..f5e0f0d020 100644 --- a/modules/angular2/src/web_workers/shared/service_message_broker.ts +++ b/modules/angular2/src/web_workers/shared/service_message_broker.ts @@ -35,11 +35,10 @@ export class ServiceMessageBroker { ObservableWrapper.subscribe(source, (message) => this._handleMessage(message)); } - registerMethod(methodName: string, signature: List, method: Function, returnType?: Type): - void { + registerMethod(methodName: string, signature: Type[], method: Function, returnType?: Type): void { this._methods.set(methodName, (message: ReceivedMessage) => { var serializedArgs = message.args; - var deserializedArgs: List = ListWrapper.createFixedSize(signature.length); + var deserializedArgs: any[] = ListWrapper.createFixedSize(signature.length); for (var i = 0; i < signature.length; i++) { var serializedArg = serializedArgs[i]; deserializedArgs[i] = this._serializer.deserialize(serializedArg, signature[i]); @@ -70,7 +69,7 @@ export class ServiceMessageBroker { export class ReceivedMessage { method: string; - args: List; + args: any[]; id: string; type: string; diff --git a/modules/angular2/src/web_workers/ui/di_bindings.ts b/modules/angular2/src/web_workers/ui/di_bindings.ts index 4e15252c8e..b22ea16bae 100644 --- a/modules/angular2/src/web_workers/ui/di_bindings.ts +++ b/modules/angular2/src/web_workers/ui/di_bindings.ts @@ -2,7 +2,7 @@ // There should be a way to refactor application so that this file is unnecessary. See #3277 import {Injector, bind, Binding} from "angular2/di"; import {Reflector, reflector} from 'angular2/src/core/reflection/reflection'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import { Parser, Lexer, @@ -76,7 +76,7 @@ var _rootBindings = [bind(Reflector).toValue(reflector)]; // TODO: This code is nearly identitcal to core/application. There should be a way to only write it // once -function _injectorBindings(): List { +function _injectorBindings(): any[] { var bestChangeDetection = new DynamicChangeDetection(); if (PreGeneratedChangeDetection.isSupported()) { bestChangeDetection = new PreGeneratedChangeDetection(); diff --git a/modules/angular2/src/web_workers/ui/event_serializer.ts b/modules/angular2/src/web_workers/ui/event_serializer.ts index 7d22567a94..13e67362ff 100644 --- a/modules/angular2/src/web_workers/ui/event_serializer.ts +++ b/modules/angular2/src/web_workers/ui/event_serializer.ts @@ -69,7 +69,7 @@ function addTarget(e: Event, serializedEvent: StringMap): StringMap return serializedEvent; } -function serializeEvent(e: any, properties: List): StringMap { +function serializeEvent(e: any, properties: string[]): StringMap { var serialized = {}; for (var i = 0; i < properties.length; i++) { var prop = properties[i]; diff --git a/modules/angular2/src/web_workers/worker/application.ts b/modules/angular2/src/web_workers/worker/application.ts index d841e91051..4234096564 100644 --- a/modules/angular2/src/web_workers/worker/application.ts +++ b/modules/angular2/src/web_workers/worker/application.ts @@ -28,7 +28,7 @@ var _postMessage: PostMessageInterface = postMessage; * See the bootstrap() docs for more details. */ export function bootstrapWebWorker( - appComponentType: Type, componentInjectableBindings: List> = null): + appComponentType: Type, componentInjectableBindings: Array = null): Promise { var sink = new PostMessageBusSink({ postMessage: diff --git a/modules/angular2/src/web_workers/worker/application_common.ts b/modules/angular2/src/web_workers/worker/application_common.ts index eab810d027..83503f21be 100644 --- a/modules/angular2/src/web_workers/worker/application_common.ts +++ b/modules/angular2/src/web_workers/worker/application_common.ts @@ -29,7 +29,7 @@ import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver'; import {StyleUrlResolver} from 'angular2/src/core/render/dom/compiler/style_url_resolver'; import {PipeResolver} from 'angular2/src/core/compiler/pipe_resolver'; import {ViewResolver} from 'angular2/src/core/compiler/view_resolver'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async'; import {NgZone} from 'angular2/src/core/zone/ng_zone'; import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle'; @@ -77,7 +77,7 @@ class PrintLogger { } function _injectorBindings(appComponentType, bus: MessageBus, initData: StringMap): - List> { + Array { var bestChangeDetection = new DynamicChangeDetection(); if (PreGeneratedChangeDetection.isSupported()) { bestChangeDetection = new PreGeneratedChangeDetection(); @@ -141,7 +141,7 @@ function _injectorBindings(appComponentType, bus: MessageBus, initData: StringMa export function bootstrapWebWorkerCommon( appComponentType: Type, bus: MessageBus, - componentInjectableBindings: List> = null): Promise { + componentInjectableBindings: Array = null): Promise { var bootstrapProcess: PromiseCompleter = PromiseWrapper.completer(); var zone = new NgZone({enableLongStackTrace: assertionsEnabled()}); @@ -184,7 +184,7 @@ export function bootstrapWebWorkerCommon( return bootstrapProcess.promise; } -function _createAppInjector(appComponentType: Type, bindings: List>, +function _createAppInjector(appComponentType: Type, bindings: Array, zone: NgZone, bus: MessageBus, initData: StringMap): Injector { if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings); diff --git a/modules/angular2/src/web_workers/worker/renderer.ts b/modules/angular2/src/web_workers/worker/renderer.ts index 77fb65478f..a2217883fe 100644 --- a/modules/angular2/src/web_workers/worker/renderer.ts +++ b/modules/angular2/src/web_workers/worker/renderer.ts @@ -42,7 +42,7 @@ export class WebWorkerCompiler implements RenderCompiler { * Creats a ProtoViewDto that contains a single nested component with the given componentId. */ compileHost(directiveMetadata: RenderDirectiveMetadata): Promise { - var fnArgs: List = [new FnArg(directiveMetadata, RenderDirectiveMetadata)]; + var fnArgs: FnArg[] = [new FnArg(directiveMetadata, RenderDirectiveMetadata)]; var args: UiArguments = new UiArguments("compileHost", fnArgs); return this._messageBroker.runOnUiThread(args, ProtoViewDto); } @@ -53,7 +53,7 @@ export class WebWorkerCompiler implements RenderCompiler { * but only the needed ones based on previous calls. */ compile(view: ViewDefinition): Promise { - var fnArgs: List = [new FnArg(view, ViewDefinition)]; + var fnArgs: FnArg[] = [new FnArg(view, ViewDefinition)]; var args: UiArguments = new UiArguments("compile", fnArgs); return this._messageBroker.runOnUiThread(args, ProtoViewDto); } @@ -64,12 +64,12 @@ export class WebWorkerCompiler implements RenderCompiler { * should be merged. * If the array contains other arrays, they will be merged before processing the parent array. * The array must contain an entry for every component and embedded ProtoView of the first entry. - * @param protoViewRefs List of ProtoViewRefs or nested + * @param protoViewRefs Array of ProtoViewRefs or nested * @return the merge result for every input array in depth first order. */ mergeProtoViewsRecursively( - protoViewRefs: List>): Promise { - var fnArgs: List = [new FnArg(protoViewRefs, RenderProtoViewRef)]; + protoViewRefs: Array): Promise { + var fnArgs: FnArg[] = [new FnArg(protoViewRefs, RenderProtoViewRef)]; var args: UiArguments = new UiArguments("mergeProtoViewsRecursively", fnArgs); return this._messageBroker.runOnUiThread(args, RenderProtoViewMergeMapping); } @@ -114,7 +114,7 @@ export class WebWorkerRenderer implements Renderer { var renderViewWithFragments = this._renderViewStore.allocate(fragmentCount); var startIndex = ((renderViewWithFragments.viewRef)).refNumber; - var fnArgs: List = [ + var fnArgs: FnArg[] = [ new FnArg(protoViewRef, RenderProtoViewRef), new FnArg(fragmentCount, null), ]; @@ -255,7 +255,7 @@ export class WebWorkerRenderer implements Renderer { * Calls a method on an element. * Note: For now we're assuming that everything in the args list are primitive */ - invokeElementMethod(location: RenderElementRef, methodName: string, args: List) { + invokeElementMethod(location: RenderElementRef, methodName: string, args: any[]) { var fnArgs = [ new FnArg(location, WebWorkerElementRef), new FnArg(methodName, null), diff --git a/modules/angular2/src/web_workers/worker/xhr_impl.ts b/modules/angular2/src/web_workers/worker/xhr_impl.ts index 4dcc4569a4..ae8c09c98c 100644 --- a/modules/angular2/src/web_workers/worker/xhr_impl.ts +++ b/modules/angular2/src/web_workers/worker/xhr_impl.ts @@ -23,7 +23,7 @@ export class WebWorkerXHRImpl extends XHR { } get(url: string): Promise { - var fnArgs: List = [new FnArg(url, null)]; + var fnArgs: FnArg[] = [new FnArg(url, null)]; var args: UiArguments = new UiArguments("get", fnArgs); return this._messageBroker.runOnUiThread(args, String); } diff --git a/modules/angular2/test/core/change_detection/change_detector_config.ts b/modules/angular2/test/core/change_detection/change_detector_config.ts index bbdb580053..9dc8c04e99 100644 --- a/modules/angular2/test/core/change_detection/change_detector_config.ts +++ b/modules/angular2/test/core/change_detection/change_detector_config.ts @@ -26,12 +26,12 @@ function _getParser() { return _parser; } -function _createBindingRecords(expression: string): List { +function _createBindingRecords(expression: string): BindingRecord[] { var ast = _getParser().parseBinding(expression, 'location'); return [BindingRecord.createForElementProperty(ast, 0, PROP_NAME)]; } -function _createEventRecords(expression: string): List { +function _createEventRecords(expression: string): BindingRecord[] { var eq = expression.indexOf("="); var eventName = expression.substring(1, eq - 1); var exp = expression.substring(eq + 2, expression.length - 1); @@ -40,7 +40,7 @@ function _createEventRecords(expression: string): List { } function _createHostEventRecords(expression: string, directiveRecord: DirectiveRecord): - List { + BindingRecord[] { var parts = expression.split("="); var eventName = parts[0].substring(1, parts[0].length - 1); var exp = parts[1].substring(1, parts[1].length - 1); @@ -49,7 +49,7 @@ function _createHostEventRecords(expression: string, directiveRecord: DirectiveR return [BindingRecord.createForHostEvent(ast, eventName, directiveRecord)]; } -function _convertLocalsToVariableBindings(locals: Locals): List { +function _convertLocalsToVariableBindings(locals: Locals): any[] { var variableBindings = []; var loc = locals; while (isPresent(loc) && isPresent(loc.current)) { @@ -142,17 +142,15 @@ export class TestDefinition { * Get all available ChangeDetectorDefinition objects. Used to pre-generate Dart * `ChangeDetector` classes. */ -export function getAllDefinitions(): List { +export function getAllDefinitions(): TestDefinition[] { var allDefs = _availableDefinitions; allDefs = ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithLocals.availableDefinitions)); - allDefs = - ListWrapper.concat(allDefs, StringMapWrapper.keys(_ExpressionWithMode.availableDefinitions)); - allDefs = - ListWrapper.concat(allDefs, StringMapWrapper.keys(_DirectiveUpdating.availableDefinitions)); - allDefs = ListWrapper.concat(allDefs, _availableEventDefinitions); - allDefs = ListWrapper.concat(allDefs, _availableHostEventDefinitions); - allDefs = ListWrapper.concat(allDefs, [ + allDefs = allDefs.concat(StringMapWrapper.keys(_ExpressionWithMode.availableDefinitions)); + allDefs = allDefs.concat(StringMapWrapper.keys(_DirectiveUpdating.availableDefinitions)); + allDefs = allDefs.concat(_availableEventDefinitions); + allDefs = allDefs.concat(_availableHostEventDefinitions); + allDefs = allDefs.concat([ "onPushObserveBinding", "onPushObserveComponent", "onPushObserveDirective", @@ -256,8 +254,8 @@ class _ExpressionWithMode { } class _DirectiveUpdating { - constructor(private _bindingRecords: List, - private _directiveRecords: List) {} + constructor(private _bindingRecords: BindingRecord[], + private _directiveRecords: DirectiveRecord[]) {} createChangeDetectorDefinition(): ChangeDetectorDefinition { var strategy = null; @@ -279,7 +277,7 @@ class _DirectiveUpdating { (o, v) => (o).b = v, dirRecord); } - static basicRecords: List = [ + static basicRecords: DirectiveRecord[] = [ new DirectiveRecord({ directiveIndex: new DirectiveIndex(0, 0), callOnChanges: true, diff --git a/modules/angular2/test/core/change_detection/change_detector_spec.ts b/modules/angular2/test/core/change_detection/change_detector_spec.ts index e46c38be55..26069194d9 100644 --- a/modules/angular2/test/core/change_detection/change_detector_spec.ts +++ b/modules/angular2/test/core/change_detection/change_detector_spec.ts @@ -19,7 +19,7 @@ import { BaseException, FunctionWrapper } from 'angular2/src/core/facade/lang'; -import {List, ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import { ChangeDispatcher, @@ -1343,8 +1343,8 @@ class TestData { } class FakeDirectives { - constructor(public directives: List, - public detectors: List) {} + constructor(public directives: Array, + public detectors: ProtoChangeDetector[]) {} getDirectiveFor(di: DirectiveIndex) { return this.directives[di.directiveIndex]; } @@ -1354,7 +1354,7 @@ class FakeDirectives { class TestDispatcher implements ChangeDispatcher { log: string[]; debugLog: string[]; - loggedValues: List; + loggedValues: any[]; afterContentCheckedCalled: boolean = false; afterViewCheckedCalled: boolean = false; diff --git a/modules/angular2/test/core/change_detection/differs/default_iterable_differ_spec.ts b/modules/angular2/test/core/change_detection/differs/default_iterable_differ_spec.ts index 1db5b8da30..0fc68e94e7 100644 --- a/modules/angular2/test/core/change_detection/differs/default_iterable_differ_spec.ts +++ b/modules/angular2/test/core/change_detection/differs/default_iterable_differ_spec.ts @@ -190,7 +190,7 @@ export function main() { var b = 'b'; var oo = 'oo'; - ListWrapper.set(l, 1, b + oo); + l[1] = b + oo; differ.check(l); expect(differ.toString()) .toEqual(iterableChangesAsString({collection: ['a', 'boo'], previous: ['a', 'boo']})); diff --git a/modules/angular2/test/core/change_detection/iterable.ts b/modules/angular2/test/core/change_detection/iterable.ts index 4d5eadf2ce..e44c4ab6f6 100644 --- a/modules/angular2/test/core/change_detection/iterable.ts +++ b/modules/angular2/test/core/change_detection/iterable.ts @@ -1,7 +1,6 @@ -import {List} from 'angular2/src/core/facade/collection'; export class TestIterable { - list: List; + list: number[]; constructor() { this.list = []; } [Symbol.iterator]() { return this.list[Symbol.iterator](); } diff --git a/modules/angular2/test/core/change_detection/parser/lexer_spec.ts b/modules/angular2/test/core/change_detection/parser/lexer_spec.ts index 490d1671f9..3a310288b5 100644 --- a/modules/angular2/test/core/change_detection/parser/lexer_spec.ts +++ b/modules/angular2/test/core/change_detection/parser/lexer_spec.ts @@ -2,10 +2,9 @@ import {ddescribe, describe, it, expect} from 'angular2/test_lib'; import {Lexer, Token} from 'angular2/src/core/change_detection/parser/lexer'; -import {List, ListWrapper} from "angular2/src/core/facade/collection"; import {StringWrapper} from "angular2/src/core/facade/lang"; -function lex(text: string): List { +function lex(text: string): any[] { return new Lexer().tokenize(text); } @@ -53,13 +52,13 @@ export function main() { describe('lexer', function() { describe('token', function() { it('should tokenize a simple identifier', function() { - var tokens: List = lex("j"); + var tokens: number[] = 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: number[] = lex("j.k"); expect(tokens.length).toEqual(3); expectIdentifierToken(tokens[0], 0, 'j'); expectCharacterToken(tokens[1], 1, '.'); @@ -67,20 +66,20 @@ export function main() { }); it('should tokenize an operator', function() { - var tokens: List = lex("j-k"); + var tokens: number[] = 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: number[] = 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: number[] = lex("88"); expect(tokens.length).toEqual(1); expectNumberToken(tokens[0], 0, 88); }); @@ -95,7 +94,7 @@ export function main() { function() { expectStringToken(lex('"a\\""')[0], 0, 'a"'); }); it('should tokenize a string', function() { - var tokens: List = lex("j-a.bc[22]+1.3|f:'a\\\'c':\"d\\\"e\""); + var tokens: Token[] = lex("j-a.bc[22]+1.3|f:'a\\\'c':\"d\\\"e\""); expectIdentifierToken(tokens[0], 0, 'j'); expectOperatorToken(tokens[1], 1, '-'); expectIdentifierToken(tokens[2], 2, 'a'); @@ -115,39 +114,39 @@ export function main() { }); it('should tokenize undefined', function() { - var tokens: List = lex("undefined"); + var tokens: Token[] = lex("undefined"); expectKeywordToken(tokens[0], 0, "undefined"); expect(tokens[0].isKeywordUndefined()).toBe(true); }); it('should ignore whitespace', function() { - var tokens: List = lex("a \t \n \r b"); + var tokens: Token[] = lex("a \t \n \r b"); expectIdentifierToken(tokens[0], 0, 'a'); expectIdentifierToken(tokens[1], 8, 'b'); }); it('should tokenize quoted string', () => { var str = "['\\'', \"\\\"\"]"; - var tokens: List = lex(str); + var tokens: Token[] = lex(str); expectStringToken(tokens[1], 1, "'"); expectStringToken(tokens[3], 7, '"'); }); it('should tokenize escaped quoted string', () => { var str = '"\\"\\n\\f\\r\\t\\v\\u00A0"'; - var tokens: List = lex(str); + var tokens: Token[] = lex(str); expect(tokens.length).toEqual(1); expect(tokens[0].toString()).toEqual('"\n\f\r\t\v\u00A0'); }); it('should tokenize unicode', function() { - var tokens: List = lex('"\\u00A0"'); + var tokens: Token[] = lex('"\\u00A0"'); expect(tokens.length).toEqual(1); expect(tokens[0].toString()).toEqual('\u00a0'); }); it('should tokenize relation', function() { - var tokens: List = lex("! == != < > <= >= === !=="); + var tokens: Token[] = lex("! == != < > <= >= === !=="); expectOperatorToken(tokens[0], 0, '!'); expectOperatorToken(tokens[1], 2, '=='); expectOperatorToken(tokens[2], 5, '!='); @@ -160,7 +159,7 @@ export function main() { }); it('should tokenize statements', function() { - var tokens: List = lex("a;b;"); + var tokens: Token[] = lex("a;b;"); expectIdentifierToken(tokens[0], 0, 'a'); expectCharacterToken(tokens[1], 1, ';'); expectIdentifierToken(tokens[2], 2, 'b'); @@ -168,19 +167,19 @@ export function main() { }); it('should tokenize function invocation', function() { - var tokens: List = lex("a()"); + var tokens: Token[] = lex("a()"); expectIdentifierToken(tokens[0], 0, 'a'); expectCharacterToken(tokens[1], 1, '('); expectCharacterToken(tokens[2], 2, ')'); }); it('should tokenize simple method invocations', function() { - var tokens: List = lex("a.method()"); + var tokens: Token[] = lex("a.method()"); expectIdentifierToken(tokens[2], 2, 'method'); }); it('should tokenize method invocation', function() { - var tokens: List = lex("a.b.c (d) - e.f()"); + var tokens: Token[] = lex("a.b.c (d) - e.f()"); expectIdentifierToken(tokens[0], 0, 'a'); expectCharacterToken(tokens[1], 1, '.'); expectIdentifierToken(tokens[2], 2, 'b'); @@ -198,18 +197,18 @@ export function main() { }); it('should tokenize number', function() { - var tokens: List = lex("0.5"); + var tokens: Token[] = lex("0.5"); expectNumberToken(tokens[0], 0, 0.5); }); // NOTE(deboer): NOT A LEXER TEST // it('should tokenize negative number', () => { - // var tokens:List = lex("-0.5"); + // var tokens:Token[] = lex("-0.5"); // expectNumberToken(tokens[0], 0, -0.5); // }); it('should tokenize number with exponent', function() { - var tokens: List = lex("0.5E-10"); + var tokens: Token[] = lex("0.5E-10"); expect(tokens.length).toEqual(1); expectNumberToken(tokens[0], 0, 0.5E-10); tokens = lex("0.5E+10"); @@ -225,7 +224,7 @@ export function main() { }); it('should tokenize number starting with a dot', function() { - var tokens: List = lex(".5"); + var tokens: Token[] = lex(".5"); expectNumberToken(tokens[0], 0, 0.5); }); @@ -236,12 +235,12 @@ export function main() { }); it('should tokenize hash as operator', function() { - var tokens: List = lex("#"); + var tokens: Token[] = lex("#"); expectOperatorToken(tokens[0], 0, '#'); }); it('should tokenize ?. as operator', () => { - var tokens: List = lex('?.'); + var tokens: Token[] = lex('?.'); expectOperatorToken(tokens[0], 0, '?.'); }); diff --git a/modules/angular2/test/core/change_detection/util.ts b/modules/angular2/test/core/change_detection/util.ts index 2a0668ef75..b252a3124c 100644 --- a/modules/angular2/test/core/change_detection/util.ts +++ b/modules/angular2/test/core/change_detection/util.ts @@ -8,13 +8,10 @@ export function iterableChangesAsString({collection = CONST_EXPR([]), previous = "removals: " + removals.join(', ') + "\n"; } -export function kvChangesAsString({map, previous, additions, changes, removals}: { - map?: List, - previous?: List, - additions?: List, - changes?: List, - removals?: List -}): string { +export function kvChangesAsString( + {map, previous, additions, changes, removals}: + {map?: any[], previous?: any[], additions?: any[], changes?: any[], removals?: any[]}): + string { if (isBlank(map)) map = []; if (isBlank(previous)) previous = []; if (isBlank(additions)) additions = []; diff --git a/modules/angular2/test/core/compiler/compiler_spec.ts b/modules/angular2/test/core/compiler/compiler_spec.ts index c676bffcb1..f1b7c62d1a 100644 --- a/modules/angular2/test/core/compiler/compiler_spec.ts +++ b/modules/angular2/test/core/compiler/compiler_spec.ts @@ -11,13 +11,7 @@ import { it } from 'angular2/test_lib'; import {SpyRenderCompiler, SpyDirectiveResolver} from '../spies'; -import { - List, - ListWrapper, - Map, - MapWrapper, - StringMapWrapper -} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {Type, isBlank, stringify, isPresent, isArray} from 'angular2/src/core/facade/lang'; import {PromiseCompleter, PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; @@ -59,8 +53,8 @@ export function main() { cmpUrlMapper, rootProtoView; var renderCompileRequests: any[]; - function createCompiler(renderCompileResults: List>, - protoViewFactoryResults: List) { + function createCompiler(renderCompileResults: Array>, + protoViewFactoryResults: AppProtoView[]) { var urlResolver = new UrlResolver(); renderCompileRequests = []; renderCompileResults = ListWrapper.clone(renderCompileResults); @@ -87,7 +81,7 @@ export function main() { createRenderProtoView([createRenderComponentElementBinder(0)], ViewType.HOST)); }); renderCompiler.spy('mergeProtoViewsRecursively') - .andCallFake((protoViewRefs: List>) => { + .andCallFake((protoViewRefs: Array) => { return PromiseWrapper.resolve(new RenderProtoViewMergeMapping( new MergedRenderProtoViewRef(protoViewRefs), 1, [], 0, [], [], [null])); }); @@ -722,15 +716,15 @@ class FakeViewResolver extends ViewResolver { } class FakeProtoViewFactory extends ProtoViewFactory { - requests: List>; + requests: any[][]; - constructor(public results: List) { + constructor(public results: AppProtoView[]) { super(null); this.requests = []; } createAppProtoViews(componentBinding: DirectiveBinding, renderProtoView: ProtoViewDto, - directives: List, pipes: PipeBinding[]): AppProtoView[] { + directives: DirectiveBinding[], pipes: PipeBinding[]): AppProtoView[] { this.requests.push([componentBinding, renderProtoView, directives, pipes]); return collectEmbeddedPvs(ListWrapper.removeAt(this.results, 0)); } diff --git a/modules/angular2/test/core/compiler/element_injector_spec.ts b/modules/angular2/test/core/compiler/element_injector_spec.ts index e2eb68c2f8..1371ac88dd 100644 --- a/modules/angular2/test/core/compiler/element_injector_spec.ts +++ b/modules/angular2/test/core/compiler/element_injector_spec.ts @@ -20,7 +20,6 @@ import {isBlank, isPresent, stringify} from 'angular2/src/core/facade/lang'; import { ListWrapper, MapWrapper, - List, StringMapWrapper, iterateListLike } from 'angular2/src/core/facade/collection'; @@ -242,7 +241,7 @@ export function main() { return ProtoElementInjector.create(parent, index, directiveBinding, hasShadowRoot, distance, dirVariableBindings); } - function humanize(tree: TreeNode, names: List>) { + function humanize(tree: TreeNode, names: any[][]) { var lookupName = (item) => ListWrapper.last(ListWrapper.find(names, (pair) => pair[0] === item)); @@ -277,8 +276,8 @@ export function main() { return child; } - function hostShadowInjectors(hostBindings: List, - shadowBindings: List, imperativelyCreatedInjector = null): ElementInjector { + function hostShadowInjectors(hostBindings: any[], + shadowBindings: any[], imperativelyCreatedInjector = null): ElementInjector { var protoHost = createPei(null, 0, hostBindings, 0, true); var host = protoHost.instantiate(null); host.hydrate(null, null, defaultPreBuiltObjects); @@ -1078,7 +1077,7 @@ export function main() { "one": null // element }); - var inj = injector(ListWrapper.concat(dirs, extraBindings), null, + var inj = injector(dirs.concat(extraBindings), null, false, preBuildObjects, null, dirVariableBindings); expect(inj.get(NeedsQueryByVarBindings).query.first).toBe(defaultPreBuiltObjects.elementRef); @@ -1093,7 +1092,7 @@ export function main() { "two": 1 // 1 is the index of NeedsDirective }); - var inj = injector(ListWrapper.concat(dirs, extraBindings), null, + var inj = injector(dirs.concat(extraBindings), null, false, preBuildObjects, null, dirVariableBindings); // NeedsQueryByVarBindings queries "one,two", so SimpleDirective should be before NeedsDirective diff --git a/modules/angular2/test/core/compiler/query_list_spec.ts b/modules/angular2/test/core/compiler/query_list_spec.ts index 5dfa2f198f..c3738dada6 100644 --- a/modules/angular2/test/core/compiler/query_list_spec.ts +++ b/modules/angular2/test/core/compiler/query_list_spec.ts @@ -1,6 +1,6 @@ import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib'; -import {List, MapWrapper, ListWrapper, iterateListLike} from 'angular2/src/core/facade/collection'; +import {MapWrapper, ListWrapper, iterateListLike} from 'angular2/src/core/facade/collection'; import {StringWrapper} from 'angular2/src/core/facade/lang'; import {QueryList} from 'angular2/src/core/compiler/query_list'; diff --git a/modules/angular2/test/core/debug/debug_element_spec.ts b/modules/angular2/test/core/debug/debug_element_spec.ts index c9daef8182..3b2d523ee5 100644 --- a/modules/angular2/test/core/debug/debug_element_spec.ts +++ b/modules/angular2/test/core/debug/debug_element_spec.ts @@ -18,7 +18,7 @@ import { import {DOM} from 'angular2/src/core/dom/dom_adapter'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {PromiseWrapper, EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; import {Injectable} from 'angular2/di'; @@ -33,7 +33,7 @@ import {NgFor} from 'angular2/src/core/directives/ng_for'; @Injectable() class Logger { - log: List; + log: string[]; constructor() { this.log = []; } @@ -119,7 +119,7 @@ class EventsComp { }) @Injectable() class UsingFor { - stuff: List; + stuff: string[]; constructor() { this.stuff = ['one', 'two', 'three']; } } diff --git a/modules/angular2/test/core/directives/ng_class_spec.ts b/modules/angular2/test/core/directives/ng_class_spec.ts index e093e5f599..698d8b13f0 100644 --- a/modules/angular2/test/core/directives/ng_class_spec.ts +++ b/modules/angular2/test/core/directives/ng_class_spec.ts @@ -13,7 +13,7 @@ import { it, xit, } from 'angular2/test_lib'; -import {List, ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {Component, View, NgFor, bind} from 'angular2/angular2'; import {NgClass} from 'angular2/src/core/directives/ng_class'; import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool'; @@ -172,7 +172,7 @@ export function main() { tcb.overrideTemplate(TestComponent, template) .createAsync(TestComponent) .then((rootTC) => { - var arrExpr: List = rootTC.componentInstance.arrExpr; + var arrExpr: string[] = rootTC.componentInstance.arrExpr; detectChangesAndCheck(rootTC, 'ng-binding foo'); arrExpr.push('bar'); @@ -405,7 +405,7 @@ export function main() { class TestComponent { condition: boolean = true; items: any[]; - arrExpr: List = ['foo']; + arrExpr: string[] = ['foo']; objExpr = {'foo': true, 'bar': false}; strExpr = 'foo'; } diff --git a/modules/angular2/test/core/facade/collection_spec.ts b/modules/angular2/test/core/facade/collection_spec.ts index 0ac6255e1e..dafdd322fa 100644 --- a/modules/angular2/test/core/facade/collection_spec.ts +++ b/modules/angular2/test/core/facade/collection_spec.ts @@ -1,7 +1,6 @@ import {describe, it, expect, beforeEach, ddescribe, iit, xit} from 'angular2/test_lib'; import { - List, ListWrapper, StringMap, StringMapWrapper, @@ -10,7 +9,7 @@ import { export function main() { describe('ListWrapper', () => { - var l: List; + var l: number[]; describe('splice', () => { it('should remove sublist of given length and return it', () => { diff --git a/modules/angular2/test/core/reflection/reflector_spec.ts b/modules/angular2/test/core/reflection/reflector_spec.ts index a0df234d13..37b39fc74e 100644 --- a/modules/angular2/test/core/reflection/reflector_spec.ts +++ b/modules/angular2/test/core/reflection/reflector_spec.ts @@ -2,7 +2,6 @@ import {describe, it, iit, ddescribe, expect, beforeEach} from 'angular2/test_li import {Reflector, ReflectionInfo} from 'angular2/src/core/reflection/reflection'; import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities'; import {ClassDecorator, ParamDecorator, classDecorator, paramDecorator} from './reflector_common'; -import {List} from 'angular2/src/core/facade/collection'; import {IS_DART} from '../../platform'; class AType { @@ -216,122 +215,122 @@ export function main() { class TestObjWith00Args { - args: List; + args: any[]; constructor() { this.args = []; } } class TestObjWith01Args { - args: List; + args: any[]; constructor(a1) { this.args = [a1]; } } class TestObjWith02Args { - args: List; + args: any[]; constructor(a1, a2) { this.args = [a1, a2]; } } class TestObjWith03Args { - args: List; + args: any[]; constructor(a1, a2, a3) { this.args = [a1, a2, a3]; } } class TestObjWith04Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4) { this.args = [a1, a2, a3, a4]; } } class TestObjWith05Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5) { this.args = [a1, a2, a3, a4, a5]; } } class TestObjWith06Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6) { this.args = [a1, a2, a3, a4, a5, a6]; } } class TestObjWith07Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7) { this.args = [a1, a2, a3, a4, a5, a6, a7]; } } class TestObjWith08Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8]; } } class TestObjWith09Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9]; } } class TestObjWith10Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]; } } class TestObjWith11Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11]; } } class TestObjWith12Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12]; } } class TestObjWith13Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13]; } } class TestObjWith14Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14]; } } class TestObjWith15Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15]; } } class TestObjWith16Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16]; } } class TestObjWith17Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17]; } } class TestObjWith18Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) { this.args = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18]; } } class TestObjWith19Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) { this.args = @@ -340,7 +339,7 @@ class TestObjWith19Args { } class TestObjWith20Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) { this.args = @@ -349,7 +348,7 @@ class TestObjWith20Args { } class TestObjWith21Args { - args: List; + args: any[]; constructor(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21) { this.args = [ diff --git a/modules/angular2/test/core/render/dom/compiler/compiler_common_tests.ts b/modules/angular2/test/core/render/dom/compiler/compiler_common_tests.ts index 123350c31f..f84e551c7a 100644 --- a/modules/angular2/test/core/render/dom/compiler/compiler_common_tests.ts +++ b/modules/angular2/test/core/render/dom/compiler/compiler_common_tests.ts @@ -11,13 +11,7 @@ import { } from 'angular2/test_lib'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; -import { - List, - ListWrapper, - Map, - MapWrapper, - StringMapWrapper -} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {Type, isBlank, stringify, isPresent, BaseException} from 'angular2/src/core/facade/lang'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; @@ -296,15 +290,15 @@ function templateRoot(protoViewDto: ProtoViewDto): Element { } class MockStepFactory extends CompileStepFactory { - steps: List; - subTaskPromises: List>; + steps: CompileStep[]; + subTaskPromises: Array>; viewDef: ViewDefinition; constructor(steps) { super(); this.steps = steps; } - createSteps(viewDef): List { + createSteps(viewDef): CompileStep[] { this.viewDef = viewDef; return this.steps; } diff --git a/modules/angular2/test/core/render/dom/compiler/directive_parser_spec.ts b/modules/angular2/test/core/render/dom/compiler/directive_parser_spec.ts index 6c6af6b778..d0a38b9ce3 100644 --- a/modules/angular2/test/core/render/dom/compiler/directive_parser_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/directive_parser_spec.ts @@ -49,7 +49,7 @@ export function main() { return new ViewDefinition({componentId: 'someComponent'}); } - function process(el, propertyBindings = null, directives = null): List { + function process(el, propertyBindings = null, directives = null): ElementBinderBuilder[] { var pipeline = createPipeline(propertyBindings, directives); return ListWrapper.map( pipeline.processElements(el, ViewType.COMPONENT, createViewDefinition()), diff --git a/modules/angular2/test/core/render/dom/compiler/pipeline_spec.ts b/modules/angular2/test/core/render/dom/compiler/pipeline_spec.ts index 9121499b9f..41e75fb454 100644 --- a/modules/angular2/test/core/render/dom/compiler/pipeline_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/pipeline_spec.ts @@ -1,5 +1,5 @@ import {describe, beforeEach, it, expect, iit, ddescribe, el} from 'angular2/test_lib'; -import {ListWrapper, List, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {isPresent, NumberWrapper, StringWrapper} from 'angular2/src/core/facade/lang'; diff --git a/modules/angular2/test/core/render/dom/compiler/property_binding_parser_spec.ts b/modules/angular2/test/core/render/dom/compiler/property_binding_parser_spec.ts index ad8e70d212..a771e0cc2f 100644 --- a/modules/angular2/test/core/render/dom/compiler/property_binding_parser_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/property_binding_parser_spec.ts @@ -26,7 +26,7 @@ export function main() { return new ViewDefinition({componentId: 'someComponent'}); } - function process(element, hasNestedProtoView = false): List { + function process(element, hasNestedProtoView = false): ElementBinderBuilder[] { return ListWrapper.map( createPipeline(hasNestedProtoView) .processElements(element, ViewType.COMPONENT, createViewDefinition()), diff --git a/modules/angular2/test/core/render/dom/compiler/selector_spec.ts b/modules/angular2/test/core/render/dom/compiler/selector_spec.ts index 48ae7a7666..d209303982 100644 --- a/modules/angular2/test/core/render/dom/compiler/selector_spec.ts +++ b/modules/angular2/test/core/render/dom/compiler/selector_spec.ts @@ -2,7 +2,7 @@ import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {SelectorMatcher} from 'angular2/src/core/render/dom/compiler/selector'; import {CssSelector} from 'angular2/src/core/render/dom/compiler/selector'; -import {List, ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection'; export function main() { describe('SelectorMatcher', () => { diff --git a/modules/angular2/test/core/render/dom/dom_testbed.ts b/modules/angular2/test/core/render/dom/dom_testbed.ts index 0130d1b69a..c1ca20f7ce 100644 --- a/modules/angular2/test/core/render/dom/dom_testbed.ts +++ b/modules/angular2/test/core/render/dom/dom_testbed.ts @@ -1,6 +1,6 @@ import {Inject, Injectable} from 'angular2/di'; import {isPresent} from 'angular2/src/core/facade/lang'; -import {MapWrapper, ListWrapper, List, Map} from 'angular2/src/core/facade/collection'; +import {MapWrapper, ListWrapper, Map} from 'angular2/src/core/facade/collection'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; @@ -27,7 +27,7 @@ export class TestRootView { viewRef: RenderViewRef; fragments: RenderFragmentRef[]; hostElement: Element; - events: List>; + events: any[][]; constructor(viewWithFragments: RenderViewWithFragments) { this.viewRef = viewWithFragments.viewRef; @@ -48,9 +48,9 @@ export function elRef(renderView: RenderViewRef, boundElementIndex: number) { export function rootNodes(view: RenderViewRef) {} class LoggingEventDispatcher implements RenderEventDispatcher { - log: List>; + log: any[][]; - constructor(log: List>) { this.log = log; } + constructor(log: any[][]) { this.log = log; } dispatchRenderEvent(elementIndex: number, eventName: string, locals: Map): boolean { this.log.push([elementIndex, eventName, locals]); @@ -83,7 +83,8 @@ export class DomTestbed { return PromiseWrapper.all(promises); } - merge(protoViews: List): Promise { + merge(protoViews: + Array): Promise { return this.compiler.mergeProtoViewsRecursively(collectMergeRenderProtoViewsRecurse( protoViews[0], ListWrapper.slice(protoViews, 1))); } @@ -114,8 +115,8 @@ export class DomTestbed { } function collectMergeRenderProtoViewsRecurse(current: ProtoViewDto, - components: List): - List> { + components: Array): + Array { var result = [current.render]; current.elementBinders.forEach((elementBinder) => { if (isPresent(elementBinder.nestedProtoView)) { diff --git a/modules/angular2/test/core/render/dom/events/event_manager_spec.ts b/modules/angular2/test/core/render/dom/events/event_manager_spec.ts index b8767b3437..8dbc9b1d59 100644 --- a/modules/angular2/test/core/render/dom/events/event_manager_spec.ts +++ b/modules/angular2/test/core/render/dom/events/event_manager_spec.ts @@ -15,7 +15,7 @@ import { DomEventsPlugin } from 'angular2/src/core/render/dom/events/event_manager'; import {NgZone} from 'angular2/src/core/zone/ng_zone'; -import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; export function main() { @@ -120,10 +120,10 @@ export function main() { } class FakeEventManagerPlugin extends EventManagerPlugin { - _supports: List; + _supports: string[]; _nonBubbleEventHandlers: Map; _bubbleEventHandlers: Map; - constructor(supports: List) { + constructor(supports: string[]) { super(); this._supports = supports; this._nonBubbleEventHandlers = new Map(); diff --git a/modules/angular2/test/router/integration/lifecycle_hook_spec.ts b/modules/angular2/test/router/integration/lifecycle_hook_spec.ts index 311de3b928..5a24268efe 100644 --- a/modules/angular2/test/router/integration/lifecycle_hook_spec.ts +++ b/modules/angular2/test/router/integration/lifecycle_hook_spec.ts @@ -52,7 +52,7 @@ import {ComponentInstruction} from 'angular2/src/router/instruction'; import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver'; var cmpInstanceCount; -var log: List; +var log: string[]; var eventBus: EventEmitter; var completer: PromiseCompleter; diff --git a/modules/angular2/test/router/integration/outlet_spec.ts b/modules/angular2/test/router/integration/outlet_spec.ts index 4252ccb7ec..1e3bfcbe75 100644 --- a/modules/angular2/test/router/integration/outlet_spec.ts +++ b/modules/angular2/test/router/integration/outlet_spec.ts @@ -37,7 +37,7 @@ import {RouteRegistry} from 'angular2/src/router/route_registry'; import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver'; var cmpInstanceCount; -var log: List; +var log: string[]; export function main() { describe('Outlet Directive', () => { diff --git a/modules/angular2/test/web_workers/shared/mock_event_emitter.ts b/modules/angular2/test/web_workers/shared/mock_event_emitter.ts index e0c8c17784..b29d8e68a4 100644 --- a/modules/angular2/test/web_workers/shared/mock_event_emitter.ts +++ b/modules/angular2/test/web_workers/shared/mock_event_emitter.ts @@ -3,7 +3,7 @@ import * as Rx from 'rx'; import {ListWrapper} from 'angular2/src/core/facade/collection'; export class MockEventEmitter extends EventEmitter { - private _nextFns: List = []; + private _nextFns: Function[] = []; constructor() { super(); } diff --git a/modules/angular2/test/web_workers/shared/render_view_with_fragments_store_spec.ts b/modules/angular2/test/web_workers/shared/render_view_with_fragments_store_spec.ts index b8436aa610..6ee81b7eaf 100644 --- a/modules/angular2/test/web_workers/shared/render_view_with_fragments_store_spec.ts +++ b/modules/angular2/test/web_workers/shared/render_view_with_fragments_store_spec.ts @@ -9,7 +9,7 @@ import { WebWorkerRenderViewRef, WebWorkerRenderFragmentRef } from "angular2/src/web_workers/shared/render_view_with_fragments_store"; -import {List, ListWrapper} from "angular2/src/core/facade/collection"; +import {ListWrapper} from "angular2/src/core/facade/collection"; export function main() { describe("RenderViewWithFragmentsStore", () => { @@ -23,8 +23,8 @@ export function main() { var viewRef: WebWorkerRenderViewRef = view.viewRef; expect(viewRef.refNumber).toEqual(0); - var fragmentRefs: List = - >view.fragmentRefs; + var fragmentRefs: WebWorkerRenderFragmentRef[] = + view.fragmentRefs; expect(fragmentRefs.length).toEqual(10); for (var i = 0; i < fragmentRefs.length; i++) { diff --git a/modules/angular2/traceur-runtime.d.ts b/modules/angular2/traceur-runtime.d.ts index 8f78106a74..7e6cbe526c 100644 --- a/modules/angular2/traceur-runtime.d.ts +++ b/modules/angular2/traceur-runtime.d.ts @@ -53,8 +53,8 @@ interface Map { clear(): void; delete (key: K): boolean; forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - keys(): List; - values(): List; + keys(): Array; + values(): Array; get(key: K): V; has(key: K): boolean; set(key: K, value: V): Map; @@ -65,7 +65,7 @@ declare var Map: { new(): Map; // alexeagle: PATCHED new(m: Map): Map; - new(l: List): Map; + new(l: Array): Map; prototype: Map; }; @@ -82,7 +82,7 @@ declare var Set: { new(): Set; // alexeagle PATCHED new(s: Set): Set; - new(l: List): Set; + new(l: Array): Set; prototype: Set; }; 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 1f5c1ecea7..d7b3119f7b 100644 --- a/modules/angular2_material/src/components/grid_list/grid_list.ts +++ b/modules/angular2_material/src/components/grid_list/grid_list.ts @@ -35,8 +35,8 @@ class RowHeightMode { encapsulation: ViewEncapsulation.NONE }) export class MdGridList { - /** List of tiles that are being rendered. */ - tiles: List; + /** Array of tiles that are being rendered. */ + tiles: MdGridTile[]; /** Number of columns being rendered. */ _cols: number; @@ -302,7 +302,7 @@ export class MdGridTile { */ class TileCoordinator { // Tracking array (see class description). - tracker: List; + tracker: number[]; // Index at which the search for the next gap will start. columnIndex: number; @@ -311,9 +311,9 @@ class TileCoordinator { rowIndex: number; // The computed (row, col) position of each tile (the output). - positions: List; + positions: Position[]; - constructor(numColumns: number, tiles: List) { + constructor(numColumns: number, tiles: MdGridTile[]) { this.columnIndex = 0; this.rowIndex = 0; diff --git a/modules/angular2_material/src/components/radio/radio_button.ts b/modules/angular2_material/src/components/radio/radio_button.ts index 12e78c05c7..760cbe7d1a 100644 --- a/modules/angular2_material/src/components/radio/radio_button.ts +++ b/modules/angular2_material/src/components/radio/radio_button.ts @@ -59,8 +59,8 @@ export class MdRadioGroup { /** Dispatcher for coordinating radio unique-selection by name. */ radioDispatcher: MdRadioDispatcher; - /** List of child radio buttons. */ - radios_: List; + /** Array of child radio buttons. */ + radios_: MdRadioButton[]; activedescendant: any; diff --git a/modules/angular2_material/src/components/radio/radio_dispatcher.ts b/modules/angular2_material/src/components/radio/radio_dispatcher.ts index 8834b51348..5aff62f3ea 100644 --- a/modules/angular2_material/src/components/radio/radio_dispatcher.ts +++ b/modules/angular2_material/src/components/radio/radio_dispatcher.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; /** * Class for radio buttons to coordinate unique selection based on name. @@ -6,7 +6,7 @@ import {List, ListWrapper} from 'angular2/src/core/facade/collection'; */ export class MdRadioDispatcher { // TODO(jelbourn): Change this to TypeScript syntax when supported. - listeners_: List; + listeners_: Function[]; constructor() { this.listeners_ = []; diff --git a/modules/benchmarks/src/compiler/compiler_benchmark.ts b/modules/benchmarks/src/compiler/compiler_benchmark.ts index 10cf72a771..526f9de767 100644 --- a/modules/benchmarks/src/compiler/compiler_benchmark.ts +++ b/modules/benchmarks/src/compiler/compiler_benchmark.ts @@ -1,6 +1,6 @@ import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter'; import {PromiseWrapper} from 'angular2/src/core/facade/async'; -import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection'; import {DateWrapper, Type, print} from 'angular2/src/core/facade/lang'; import { @@ -107,7 +107,7 @@ class MultipleViewResolver extends ViewResolver { _multiple: number; _cache: Map; - constructor(multiple: number, components: List) { + constructor(multiple: number, components: Type[]) { super(); this._multiple = multiple; this._cache = new Map(); diff --git a/modules/benchmarks/src/costs/index.ts b/modules/benchmarks/src/costs/index.ts index 3eeddbe39b..22e4256e68 100644 --- a/modules/benchmarks/src/costs/index.ts +++ b/modules/benchmarks/src/costs/index.ts @@ -7,7 +7,7 @@ import { View } from 'angular2/bootstrap'; import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; import {NgIf, NgFor} from 'angular2/directives'; @@ -83,7 +83,7 @@ class DynamicDummy { ` }) class AppComponent { - list: List; + list: any[]; testingPlainComponents: boolean; testingWithDirectives: boolean; testingDynamicComponents: boolean; diff --git a/modules/benchmarks/src/naive_infinite_scroll/app.ts b/modules/benchmarks/src/naive_infinite_scroll/app.ts index fe5d45aacb..cdcd02d1ee 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/app.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/app.ts @@ -1,7 +1,6 @@ import {isPresent} from 'angular2/src/core/facade/lang'; import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; import {TimerWrapper} from 'angular2/src/core/facade/async'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; import {ScrollAreaComponent} from './scroll_area'; import {NgIf, NgFor} from 'angular2/directives'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; @@ -25,7 +24,7 @@ import {Component, Directive, View} from 'angular2/angular2'; ` }) export class App { - scrollAreas: List; + scrollAreas: number[]; iterationCount: number; scrollIncrement: number; diff --git a/modules/benchmarks/src/naive_infinite_scroll/cells.ts b/modules/benchmarks/src/naive_infinite_scroll/cells.ts index f038a45750..caeb995d72 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/cells.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/cells.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper, Map} from 'angular2/src/core/facade/collection'; +import {ListWrapper, Map} from 'angular2/src/core/facade/collection'; import {Company, Opportunity, Offering, Account, CustomDate, STATUS_LIST} from './common'; import {NgFor} from 'angular2/directives'; @@ -52,7 +52,7 @@ export class Stage { }) export class StageButtonsComponent extends HasStyle { _offering: Offering; - stages: List; + stages: Stage[]; get offering(): Offering { return this._offering; } diff --git a/modules/benchmarks/src/naive_infinite_scroll/index.ts b/modules/benchmarks/src/naive_infinite_scroll/index.ts index 29e5a7df74..846bf1f7f2 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/index.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/index.ts @@ -9,6 +9,6 @@ export function main() { bootstrap(App, createBindings()); } -function createBindings(): List { +function createBindings(): any[] { return [bind(APP_VIEW_POOL_CAPACITY).toValue(100000)]; } diff --git a/modules/benchmarks/src/naive_infinite_scroll/random_data.ts b/modules/benchmarks/src/naive_infinite_scroll/random_data.ts index f65d97e9ac..cf23095a52 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/random_data.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/random_data.ts @@ -1,5 +1,4 @@ import {StringWrapper} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; import { CustomDate, Offering, @@ -10,7 +9,7 @@ import { AAT_STATUS_LIST } from './common'; -export function generateOfferings(count: number): List { +export function generateOfferings(count: number): Offering[] { var res = []; for (var i = 0; i < count; i++) { res.push(generateOffering(i)); diff --git a/modules/benchmarks/src/naive_infinite_scroll/scroll_area.ts b/modules/benchmarks/src/naive_infinite_scroll/scroll_area.ts index 631db4de4b..73d8b8a5f9 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/scroll_area.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/scroll_area.ts @@ -38,8 +38,8 @@ import {NgFor} from 'angular2/directives'; ` }) export class ScrollAreaComponent { - _fullList: List; - visibleItems: List; + _fullList: Offering[]; + visibleItems: Offering[]; viewPortHeight: number; paddingDiv; diff --git a/modules/benchmarks/src/static_tree/tree_benchmark.ts b/modules/benchmarks/src/static_tree/tree_benchmark.ts index 6dccedba96..5c49f01862 100644 --- a/modules/benchmarks/src/static_tree/tree_benchmark.ts +++ b/modules/benchmarks/src/static_tree/tree_benchmark.ts @@ -11,7 +11,6 @@ import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle'; import {reflector} from 'angular2/src/core/reflection/reflection'; import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; -import {List} from 'angular2/src/core/facade/collection'; import {window, document, gc} from 'angular2/src/core/facade/browser'; import { getIntParameter, @@ -25,7 +24,7 @@ import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter'; import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool'; import {bind, Binding} from 'angular2/di'; -function createBindings(): List { +function createBindings(): Binding[] { var viewCacheCapacity = getStringParameter('viewcache') == 'true' ? 10000 : 0; return [bind(APP_VIEW_POOL_CAPACITY).toValue(viewCacheCapacity)]; } diff --git a/modules/benchmarks/src/tree/tree_benchmark.ts b/modules/benchmarks/src/tree/tree_benchmark.ts index 061adba94b..1d6285b0aa 100644 --- a/modules/benchmarks/src/tree/tree_benchmark.ts +++ b/modules/benchmarks/src/tree/tree_benchmark.ts @@ -10,7 +10,6 @@ import { import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle'; import {DOM} from 'angular2/src/core/dom/dom_adapter'; import {isPresent} from 'angular2/src/core/facade/lang'; -import {List} from 'angular2/src/core/facade/collection'; import {window, document, gc} from 'angular2/src/core/facade/browser'; import { getIntParameter, @@ -24,7 +23,7 @@ import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter'; import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool'; import {bind, Binding} from 'angular2/di'; -function createBindings(): List { +function createBindings(): Binding[] { var viewCacheCapacity = getStringParameter('viewcache') == 'true' ? 10000 : 1; return [bind(APP_VIEW_POOL_CAPACITY).toValue(viewCacheCapacity)]; } diff --git a/modules/benchpress/src/firefox_extension/lib/main.ts b/modules/benchpress/src/firefox_extension/lib/main.ts index 0c811cebf4..0fcd135a2d 100644 --- a/modules/benchpress/src/firefox_extension/lib/main.ts +++ b/modules/benchpress/src/firefox_extension/lib/main.ts @@ -6,7 +6,7 @@ var ParserUtil = require('./parser_util'); class Profiler { private _profiler; - private _markerEvents: List; + private _markerEvents: any[]; private _profilerStartTime: number; constructor() { this._profiler = Cc['@mozilla.org/tools/profiler;1'].getService(Ci.nsIProfiler); } @@ -27,7 +27,7 @@ class Profiler { return perfEvents; } - _mergeMarkerEvents(perfEvents: List): List { + _mergeMarkerEvents(perfEvents: any[]): any[] { this._markerEvents.forEach(function(markerEvent) { perfEvents.push(markerEvent); }); return perfEvents; } diff --git a/modules/benchpress/src/firefox_extension/lib/parser_util.ts b/modules/benchpress/src/firefox_extension/lib/parser_util.ts index ff7d7d9918..639696c952 100644 --- a/modules/benchpress/src/firefox_extension/lib/parser_util.ts +++ b/modules/benchpress/src/firefox_extension/lib/parser_util.ts @@ -2,12 +2,12 @@ /** * @param {Object} perfProfile The perf profile JSON object. - * @return {Array} An array of recognized events that are captured + * @return {Object[]} An array of recognized events that are captured * within the perf profile. */ -export function convertPerfProfileToEvents(perfProfile: any): List { +export function convertPerfProfileToEvents(perfProfile: any): any[] { var inProgressEvents = new Map(); // map from event name to start time - var finishedEvents = []; // Array finished events + var finishedEvents = []; // Event[] finished events var addFinishedEvent = function(eventName, startTime, endTime) { var categorizedEventName = categorizeEvent(eventName); var args = undefined; diff --git a/modules/benchpress/src/metric/multi_metric.ts b/modules/benchpress/src/metric/multi_metric.ts index 07126bd61d..fb263289ae 100644 --- a/modules/benchpress/src/metric/multi_metric.ts +++ b/modules/benchpress/src/metric/multi_metric.ts @@ -1,11 +1,11 @@ import {bind, Binding, Injector, OpaqueToken} from 'angular2/di'; -import {List, ListWrapper, StringMapWrapper, StringMap} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMapWrapper, StringMap} from 'angular2/src/core/facade/collection'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; import {Metric} from '../metric'; export class MultiMetric extends Metric { - static createBindings(childTokens): List { + static createBindings(childTokens): Binding[] { return [ bind(_CHILDREN) .toFactory( @@ -15,7 +15,7 @@ export class MultiMetric extends Metric { ]; } - constructor(private _metrics: List) { super(); } + constructor(private _metrics: Metric[]) { super(); } /** * Starts measuring @@ -52,4 +52,4 @@ function mergeStringMaps(maps): Object { return result; } -var _CHILDREN = new OpaqueToken('MultiMetric.children'); \ No newline at end of file +var _CHILDREN = new OpaqueToken('MultiMetric.children'); diff --git a/modules/benchpress/src/metric/perflog_metric.ts b/modules/benchpress/src/metric/perflog_metric.ts index c348bb2c00..0dde50624d 100644 --- a/modules/benchpress/src/metric/perflog_metric.ts +++ b/modules/benchpress/src/metric/perflog_metric.ts @@ -20,11 +20,11 @@ import {Options} from '../common_options'; */ export class PerflogMetric extends Metric { // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } // TODO(tbosch): use static values when our transpiler supports them static get SET_TIMEOUT(): OpaqueToken { return _SET_TIMEOUT; } - private _remainingEvents: List>; + private _remainingEvents: Array>; private _measureCount: number; _perfLogFeatures: PerfLogFeatures; @@ -171,7 +171,7 @@ export class PerflogMetric extends Metric { } } - _aggregateEvents(events: List>, markName): StringMap { + _aggregateEvents(events: Array>, markName): StringMap { var result = {'scriptTime': 0, 'pureScriptTime': 0}; if (this._perfLogFeatures.gc) { result['gcTime'] = 0; @@ -310,7 +310,7 @@ export class PerflogMetric extends Metric { _addFrameMetrics(result: StringMap, frameTimes: any[]) { result['frameTime.mean'] = ListWrapper.reduce(frameTimes, (a, b) => a + b, 0) / frameTimes.length; - var firstFrame = ListWrapper.get(frameTimes, 0); + var firstFrame = frameTimes[0]; result['frameTime.worst'] = ListWrapper.reduce(frameTimes, (a, b) => a > b ? a : b, firstFrame); result['frameTime.best'] = ListWrapper.reduce(frameTimes, (a, b) => a < b ? a : b, firstFrame); result['frameTime.smooth'] = diff --git a/modules/benchpress/src/reporter.ts b/modules/benchpress/src/reporter.ts index b2a779cfd4..e9f7740bc0 100644 --- a/modules/benchpress/src/reporter.ts +++ b/modules/benchpress/src/reporter.ts @@ -2,7 +2,6 @@ import {bind, Binding} from 'angular2/di'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; import {ABSTRACT, BaseException} from 'angular2/src/core/facade/lang'; import {MeasureValues} from './measure_values'; -import {List} from 'angular2/src/core/facade/collection'; /** * A reporter reports measure values and the valid sample. @@ -15,8 +14,7 @@ export class Reporter { reportMeasureValues(values: MeasureValues): Promise { throw new BaseException('NYI'); } - reportSample(completeSample: List, - validSample: List): Promise { + reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise { throw new BaseException('NYI'); } } diff --git a/modules/benchpress/src/reporter/console_reporter.ts b/modules/benchpress/src/reporter/console_reporter.ts index 546f5e34bd..b07a905533 100644 --- a/modules/benchpress/src/reporter/console_reporter.ts +++ b/modules/benchpress/src/reporter/console_reporter.ts @@ -1,5 +1,5 @@ import {print, isPresent, isBlank, NumberWrapper} from 'angular2/src/core/facade/lang'; -import {StringMapWrapper, ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; import {Math} from 'angular2/src/core/facade/math'; import {bind, Binding, OpaqueToken} from 'angular2/di'; @@ -18,7 +18,7 @@ export class ConsoleReporter extends Reporter { // TODO(tbosch): use static values when our transpiler supports them static get COLUMN_WIDTH(): OpaqueToken { return _COLUMN_WIDTH; } // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } static _lpad(value, columnWidth, fill = ' ') { @@ -38,7 +38,7 @@ export class ConsoleReporter extends Reporter { return props; } - private _metricNames: List; + private _metricNames: string[]; constructor(private _columnWidth: number, sampleDescription, private _print: Function) { super(); @@ -69,8 +69,7 @@ export class ConsoleReporter extends Reporter { return PromiseWrapper.resolve(null); } - reportSample(completeSample: List, - validSample: List): Promise { + reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise { this._printStringRow(this._metricNames.map((_) => ''), '='); this._printStringRow(ListWrapper.map(this._metricNames, (metricName) => { var sample = diff --git a/modules/benchpress/src/reporter/json_file_reporter.ts b/modules/benchpress/src/reporter/json_file_reporter.ts index e549fb2fbd..c50cf2c709 100644 --- a/modules/benchpress/src/reporter/json_file_reporter.ts +++ b/modules/benchpress/src/reporter/json_file_reporter.ts @@ -1,5 +1,4 @@ import {DateWrapper, isPresent, isBlank, Json} from 'angular2/src/core/facade/lang'; -import {List} from 'angular2/src/core/facade/collection'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; import {bind, Binding, OpaqueToken} from 'angular2/di'; @@ -16,7 +15,7 @@ export class JsonFileReporter extends Reporter { // TODO(tbosch): use static values when our transpiler supports them static get PATH(): OpaqueToken { return _PATH; } // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } _writeFile: Function; _path: string; @@ -35,8 +34,7 @@ export class JsonFileReporter extends Reporter { return PromiseWrapper.resolve(null); } - reportSample(completeSample: List, - validSample: List): Promise { + reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise { var content = Json.stringify({ 'description': this._description, 'completeSample': completeSample, diff --git a/modules/benchpress/src/reporter/multi_reporter.ts b/modules/benchpress/src/reporter/multi_reporter.ts index 77fd5d7057..668762f173 100644 --- a/modules/benchpress/src/reporter/multi_reporter.ts +++ b/modules/benchpress/src/reporter/multi_reporter.ts @@ -1,12 +1,12 @@ import {bind, Binding, Injector, OpaqueToken} from 'angular2/di'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; import {MeasureValues} from '../measure_values'; import {Reporter} from '../reporter'; export class MultiReporter extends Reporter { - static createBindings(childTokens: List): List { + static createBindings(childTokens: any[]): Binding[] { return [ bind(_CHILDREN) .toFactory( @@ -16,20 +16,19 @@ export class MultiReporter extends Reporter { ]; } - _reporters: List; + _reporters: Reporter[]; constructor(reporters) { super(); this._reporters = reporters; } - reportMeasureValues(values: MeasureValues): Promise> { + reportMeasureValues(values: MeasureValues): Promise { return PromiseWrapper.all( ListWrapper.map(this._reporters, (reporter) => reporter.reportMeasureValues(values))); } - reportSample(completeSample: List, - validSample: List): Promise> { + reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise { return PromiseWrapper.all(ListWrapper.map( this._reporters, (reporter) => reporter.reportSample(completeSample, validSample))); } diff --git a/modules/benchpress/src/runner.ts b/modules/benchpress/src/runner.ts index 1f1a5d7578..bcb63c2b1c 100644 --- a/modules/benchpress/src/runner.ts +++ b/modules/benchpress/src/runner.ts @@ -1,6 +1,5 @@ import {Injector, bind, Binding} from 'angular2/di'; import {isPresent, isBlank} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; import {Sampler, SampleState} from './sampler'; @@ -26,8 +25,8 @@ import {Options} from './common_options'; * It provides defaults, creates the injector and calls the sampler. */ export class Runner { - private _defaultBindings: List; - constructor(defaultBindings: List = null) { + private _defaultBindings: Binding[]; + constructor(defaultBindings: Binding[] = null) { if (isBlank(defaultBindings)) { defaultBindings = []; } diff --git a/modules/benchpress/src/sample_description.ts b/modules/benchpress/src/sample_description.ts index fc04d43311..8f83764d49 100644 --- a/modules/benchpress/src/sample_description.ts +++ b/modules/benchpress/src/sample_description.ts @@ -1,4 +1,4 @@ -import {StringMapWrapper, ListWrapper, List, StringMap} from 'angular2/src/core/facade/collection'; +import {StringMapWrapper, ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; import {bind, Binding, OpaqueToken} from 'angular2/di'; import {Validator} from './validator'; import {Metric} from './metric'; @@ -9,10 +9,10 @@ import {Options} from './common_options'; */ export class SampleDescription { // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } description: StringMap; - constructor(public id: string, descriptions: List>, + constructor(public id: string, descriptions: Array>, public metrics: StringMap) { this.description = {}; ListWrapper.forEach(descriptions, (description) => { diff --git a/modules/benchpress/src/sampler.ts b/modules/benchpress/src/sampler.ts index 23fac334f1..1acbb106f7 100644 --- a/modules/benchpress/src/sampler.ts +++ b/modules/benchpress/src/sampler.ts @@ -1,6 +1,6 @@ import {isPresent, isBlank, Date, DateWrapper} from 'angular2/src/core/facade/lang'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; -import {StringMapWrapper, StringMap, List, ListWrapper} from 'angular2/src/core/facade/collection'; +import {StringMapWrapper, StringMap, ListWrapper} from 'angular2/src/core/facade/collection'; import {bind, Binding, OpaqueToken} from 'angular2/di'; import {Metric} from './metric'; @@ -21,7 +21,7 @@ import {MeasureValues} from './measure_values'; */ export class Sampler { // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } _driver: WebDriverAdapter; _metric: Metric; @@ -80,7 +80,7 @@ export class Sampler { _report(state: SampleState, metricValues: StringMap): Promise { var measureValues = new MeasureValues(state.completeSample.length, this._now(), metricValues); - var completeSample = ListWrapper.concat(state.completeSample, [measureValues]); + var completeSample = state.completeSample.concat([measureValues]); var validSample = this._validator.validate(completeSample); var resultPromise = this._reporter.reportMeasureValues(measureValues); if (isPresent(validSample)) { @@ -92,7 +92,7 @@ export class Sampler { } export class SampleState { - constructor(public completeSample: List, public validSample: List) {} + constructor(public completeSample: any[], public validSample: any[]) {} } var _BINDINGS = [ diff --git a/modules/benchpress/src/statistic.ts b/modules/benchpress/src/statistic.ts index c1fc69b016..166a1cfc92 100644 --- a/modules/benchpress/src/statistic.ts +++ b/modules/benchpress/src/statistic.ts @@ -1,5 +1,5 @@ import {Math} from 'angular2/src/core/facade/math'; -import {ListWrapper, List} from 'angular2/src/core/facade/collection'; +import {ListWrapper} from 'angular2/src/core/facade/collection'; export class Statistic { static calculateCoefficientOfVariation(sample, mean) { @@ -20,7 +20,7 @@ export class Statistic { return deviation; } - static calculateRegressionSlope(xValues: List, xMean: number, yValues: List, + static calculateRegressionSlope(xValues: number[], xMean: number, yValues: number[], yMean: number) { // See http://en.wikipedia.org/wiki/Simple_linear_regression var dividendSum = 0; diff --git a/modules/benchpress/src/validator.ts b/modules/benchpress/src/validator.ts index 3c2213173e..e58f0519f5 100644 --- a/modules/benchpress/src/validator.ts +++ b/modules/benchpress/src/validator.ts @@ -1,5 +1,5 @@ import {bind, Binding} from 'angular2/di'; -import {List, StringMap} from 'angular2/src/core/facade/collection'; +import {StringMap} from 'angular2/src/core/facade/collection'; import {ABSTRACT, BaseException} from 'angular2/src/core/facade/lang'; import {MeasureValues} from './measure_values'; @@ -18,9 +18,7 @@ export class Validator { /** * Calculates a valid sample out of the complete sample */ - validate(completeSample: List): List { - throw new BaseException('NYI'); - } + validate(completeSample: MeasureValues[]): MeasureValues[] { throw new BaseException('NYI'); } /** * Returns a Map that describes the properties of the validator diff --git a/modules/benchpress/src/validator/regression_slope_validator.ts b/modules/benchpress/src/validator/regression_slope_validator.ts index ac247922c8..09b0420c62 100644 --- a/modules/benchpress/src/validator/regression_slope_validator.ts +++ b/modules/benchpress/src/validator/regression_slope_validator.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; import {bind, Binding, OpaqueToken} from 'angular2/di'; import {Validator} from '../validator'; @@ -15,7 +15,7 @@ export class RegressionSlopeValidator extends Validator { // TODO(tbosch): use static values when our transpiler supports them static get METRIC(): OpaqueToken { return _METRIC; } // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } _sampleSize: number; _metric: string; @@ -30,7 +30,7 @@ export class RegressionSlopeValidator extends Validator { return {'sampleSize': this._sampleSize, 'regressionSlopeMetric': this._metric}; } - validate(completeSample: List): List { + validate(completeSample: MeasureValues[]): MeasureValues[] { if (completeSample.length >= this._sampleSize) { var latestSample = ListWrapper.slice(completeSample, completeSample.length - this._sampleSize, completeSample.length); diff --git a/modules/benchpress/src/validator/size_validator.ts b/modules/benchpress/src/validator/size_validator.ts index a06285bb3c..d5b07c0c90 100644 --- a/modules/benchpress/src/validator/size_validator.ts +++ b/modules/benchpress/src/validator/size_validator.ts @@ -1,4 +1,4 @@ -import {List, ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; import {bind, Binding, OpaqueToken} from 'angular2/di'; import {Validator} from '../validator'; @@ -9,7 +9,7 @@ import {MeasureValues} from '../measure_values'; */ export class SizeValidator extends Validator { // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } // TODO(tbosch): use static values when our transpiler supports them static get SAMPLE_SIZE() { return _SAMPLE_SIZE; } @@ -22,7 +22,7 @@ export class SizeValidator extends Validator { describe(): StringMap { return {'sampleSize': this._sampleSize}; } - validate(completeSample: List): List { + validate(completeSample: MeasureValues[]): MeasureValues[] { if (completeSample.length >= this._sampleSize) { return ListWrapper.slice(completeSample, completeSample.length - this._sampleSize, completeSample.length); diff --git a/modules/benchpress/src/web_driver_adapter.ts b/modules/benchpress/src/web_driver_adapter.ts index e04cbc2ee7..3e6801702e 100644 --- a/modules/benchpress/src/web_driver_adapter.ts +++ b/modules/benchpress/src/web_driver_adapter.ts @@ -1,7 +1,7 @@ import {bind, Binding} from 'angular2/di'; import {Promise} from 'angular2/src/core/facade/async'; import {BaseException, ABSTRACT} from 'angular2/src/core/facade/lang'; -import {List, Map} from 'angular2/src/core/facade/collection'; +import {Map} from 'angular2/src/core/facade/collection'; /** * A WebDriverAdapter bridges API differences between different WebDriver clients, @@ -18,5 +18,5 @@ export class WebDriverAdapter { executeScript(script: string): Promise { throw new BaseException('NYI'); } executeAsyncScript(script: string): Promise { throw new BaseException('NYI'); } capabilities(): Promise> { throw new BaseException('NYI'); } - logs(type: string): Promise> { throw new BaseException('NYI'); } + logs(type: string): Promise { throw new BaseException('NYI'); } } diff --git a/modules/benchpress/src/web_driver_extension.ts b/modules/benchpress/src/web_driver_extension.ts index ea82171541..12914248a9 100644 --- a/modules/benchpress/src/web_driver_extension.ts +++ b/modules/benchpress/src/web_driver_extension.ts @@ -2,7 +2,7 @@ import {bind, Binding, Injector, OpaqueToken} from 'angular2/di'; import {BaseException, ABSTRACT, isBlank, isPresent} from 'angular2/src/core/facade/lang'; import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; -import {List, ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; import {Options} from './common_options'; @@ -13,7 +13,7 @@ import {Options} from './common_options'; */ @ABSTRACT() export class WebDriverExtension { - static bindTo(childTokens): List { + static bindTo(childTokens): Binding[] { var res = [ bind(_CHILDREN) .toFactory( @@ -57,7 +57,7 @@ export class WebDriverExtension { * Based on [Chrome Trace Event *Format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/edit) **/ - readPerfLog(): Promise> { throw new BaseException('NYI'); } + readPerfLog(): Promise { throw new BaseException('NYI'); } perfLogFeatures(): PerfLogFeatures { throw new BaseException('NYI'); } diff --git a/modules/benchpress/src/webdriver/chrome_driver_extension.ts b/modules/benchpress/src/webdriver/chrome_driver_extension.ts index a153fcf1b4..a8c6c80159 100644 --- a/modules/benchpress/src/webdriver/chrome_driver_extension.ts +++ b/modules/benchpress/src/webdriver/chrome_driver_extension.ts @@ -23,7 +23,7 @@ import {Promise} from 'angular2/src/core/facade/async'; */ export class ChromeDriverExtension extends WebDriverExtension { // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } constructor(private _driver: WebDriverAdapter) { super(); } @@ -63,8 +63,8 @@ export class ChromeDriverExtension extends WebDriverExtension { }); } - _convertPerfRecordsToEvents(chromeEvents: List>, - normalizedEvents: List> = null) { + _convertPerfRecordsToEvents(chromeEvents: Array>, + normalizedEvents: Array> = null) { if (isBlank(normalizedEvents)) { normalizedEvents = []; } diff --git a/modules/benchpress/src/webdriver/firefox_driver_extension.ts b/modules/benchpress/src/webdriver/firefox_driver_extension.ts index f37df77db3..dead668af3 100644 --- a/modules/benchpress/src/webdriver/firefox_driver_extension.ts +++ b/modules/benchpress/src/webdriver/firefox_driver_extension.ts @@ -5,7 +5,7 @@ import {WebDriverAdapter} from '../web_driver_adapter'; import {Promise} from 'angular2/src/core/facade/async'; export class FirefoxDriverExtension extends WebDriverExtension { - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } private _profilerStarted: boolean; diff --git a/modules/benchpress/src/webdriver/ios_driver_extension.ts b/modules/benchpress/src/webdriver/ios_driver_extension.ts index 7411d58bcf..33f41424e8 100644 --- a/modules/benchpress/src/webdriver/ios_driver_extension.ts +++ b/modules/benchpress/src/webdriver/ios_driver_extension.ts @@ -15,7 +15,7 @@ import {Promise} from 'angular2/src/core/facade/async'; export class IOsDriverExtension extends WebDriverExtension { // TODO(tbosch): use static values when our transpiler supports them - static get BINDINGS(): List { return _BINDINGS; } + static get BINDINGS(): Binding[] { return _BINDINGS; } constructor(private _driver: WebDriverAdapter) { super(); } diff --git a/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts b/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts index 4e398a7796..12ebd163b2 100644 --- a/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts +++ b/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts @@ -8,7 +8,7 @@ import * as webdriver from 'selenium-webdriver'; * Adapter for the selenium-webdriver. */ export class SeleniumWebDriverAdapter extends WebDriverAdapter { - static get PROTRACTOR_BINDINGS(): List { return _PROTRACTOR_BINDINGS; } + static get PROTRACTOR_BINDINGS(): Binding[] { return _PROTRACTOR_BINDINGS; } constructor(private _driver: any) { super(); } diff --git a/modules/benchpress/test/metric/multi_metric_spec.ts b/modules/benchpress/test/metric/multi_metric_spec.ts index 8f2c323e67..8940dd9be3 100644 --- a/modules/benchpress/test/metric/multi_metric_spec.ts +++ b/modules/benchpress/test/metric/multi_metric_spec.ts @@ -11,7 +11,7 @@ import { xit, } from 'angular2/test_lib'; -import {List, ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; import {Metric, MultiMetric, bind, Injector} from 'benchpress/common'; diff --git a/modules/benchpress/test/metric/perflog_metric_spec.ts b/modules/benchpress/test/metric/perflog_metric_spec.ts index 02d76eae4a..619bb2b727 100644 --- a/modules/benchpress/test/metric/perflog_metric_spec.ts +++ b/modules/benchpress/test/metric/perflog_metric_spec.ts @@ -11,7 +11,7 @@ import { xit, } from 'angular2/test_lib'; -import {List, ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; import {isPresent, isBlank} from 'angular2/src/core/facade/lang'; @@ -641,7 +641,7 @@ export function main() { } class MockDriverExtension extends WebDriverExtension { - constructor(private _perfLogs: List, private _commandLog: List, + constructor(private _perfLogs: any[], private _commandLog: any[], private _perfLogFeatures: PerfLogFeatures) { super(); } diff --git a/modules/benchpress/test/reporter/console_reporter_spec.ts b/modules/benchpress/test/reporter/console_reporter_spec.ts index e2a73e147e..e0db36230c 100644 --- a/modules/benchpress/test/reporter/console_reporter_spec.ts +++ b/modules/benchpress/test/reporter/console_reporter_spec.ts @@ -1,7 +1,6 @@ import {describe, ddescribe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib'; import {isBlank, isPresent, Date, DateWrapper} from 'angular2/src/core/facade/lang'; -import {List, ListWrapper} from 'angular2/src/core/facade/collection'; import { SampleState, diff --git a/modules/benchpress/test/reporter/multi_reporter_spec.ts b/modules/benchpress/test/reporter/multi_reporter_spec.ts index 3caaaae01c..80eb06729a 100644 --- a/modules/benchpress/test/reporter/multi_reporter_spec.ts +++ b/modules/benchpress/test/reporter/multi_reporter_spec.ts @@ -11,7 +11,7 @@ import { xit, } from 'angular2/test_lib'; -import {List, ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; +import {ListWrapper, StringMap} from 'angular2/src/core/facade/collection'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; import {DateWrapper} from 'angular2/src/core/facade/lang'; @@ -69,8 +69,8 @@ class MockReporter extends Reporter { return PromiseWrapper.resolve({'id': this._id, 'values': values}); } - reportSample(completeSample: List, - validSample: List): Promise> { + reportSample(completeSample: MeasureValues[], + validSample: MeasureValues[]): Promise> { return PromiseWrapper.resolve( {'id': this._id, 'completeSample': completeSample, 'validSample': validSample}); } diff --git a/modules/benchpress/test/sampler_spec.ts b/modules/benchpress/test/sampler_spec.ts index b15c0f267b..0ce9382598 100644 --- a/modules/benchpress/test/sampler_spec.ts +++ b/modules/benchpress/test/sampler_spec.ts @@ -19,7 +19,6 @@ import { Date, DateWrapper } from 'angular2/src/core/facade/lang'; -import {ListWrapper, List} from 'angular2/src/core/facade/collection'; import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async'; import { @@ -251,7 +250,7 @@ function createCountingMetric(log = null) { } class MockDriverAdapter extends WebDriverAdapter { - private _log: List; + private _log: any[]; private _waitFor: Function; constructor(log = null, waitFor = null) { super(); @@ -272,7 +271,7 @@ class MockDriverAdapter extends WebDriverAdapter { class MockValidator extends Validator { - private _log: List; + private _log: any[]; constructor(log = null, private _validate: Function = null) { super(); if (isBlank(log)) { @@ -280,7 +279,7 @@ class MockValidator extends Validator { } this._log = log; } - validate(completeSample: List): List { + validate(completeSample: MeasureValues[]): MeasureValues[] { var stableSample = isPresent(this._validate) ? this._validate(completeSample) : completeSample; this._log.push(['validate', completeSample, stableSample]); return stableSample; @@ -288,7 +287,7 @@ class MockValidator extends Validator { } class MockMetric extends Metric { - private _log: List; + private _log: any[]; constructor(log = null, private _endMeasure: Function = null) { super(); if (isBlank(log)) { @@ -308,7 +307,7 @@ class MockMetric extends Metric { } class MockReporter extends Reporter { - _log: List; + _log: any[]; constructor(log = null) { super(); if (isBlank(log)) { diff --git a/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts b/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts index 4924213ab6..d20ef5069f 100644 --- a/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts +++ b/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts @@ -302,7 +302,7 @@ export function main() { } class MockDriverAdapter extends WebDriverAdapter { - constructor(private _log: List, private _events: List, private _messageMethod: string) { + constructor(private _log: any[], private _events: any[], private _messageMethod: string) { super(); } diff --git a/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts b/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts index 852c88cfd1..bd0776460c 100644 --- a/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts +++ b/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts @@ -192,7 +192,7 @@ function internalScriptRecord(startTime, endTime) { } class MockDriverAdapter extends WebDriverAdapter { - constructor(private _log: List, private _perfRecords: List) { super(); } + constructor(private _log: any[], private _perfRecords: any[]) { super(); } executeScript(script) { this._log.push(['executeScript', script]); diff --git a/modules/examples/src/material/button/index.ts b/modules/examples/src/material/button/index.ts index 2fe9a9f4d8..1d7e6969ac 100644 --- a/modules/examples/src/material/button/index.ts +++ b/modules/examples/src/material/button/index.ts @@ -16,7 +16,7 @@ class DemoApp { previousClick: string; action: string; clickCount: number; - items: List; + items: number[]; constructor() { this.previousClick = 'Nothing'; diff --git a/modules/examples/src/model_driven_forms/index.ts b/modules/examples/src/model_driven_forms/index.ts index 96a5563933..da3dba944f 100644 --- a/modules/examples/src/model_driven_forms/index.ts +++ b/modules/examples/src/model_driven_forms/index.ts @@ -39,7 +39,7 @@ function creditCardValidator(c): StringMap { class ShowError { formDir; controlPath: string; - errorTypes: List; + errorTypes: string[]; constructor(@Host() formDir: NgFormModel) { this.formDir = formDir; } diff --git a/modules/examples/src/person_management/index.ts b/modules/examples/src/person_management/index.ts index a4fc646a94..a176954ed6 100644 --- a/modules/examples/src/person_management/index.ts +++ b/modules/examples/src/person_management/index.ts @@ -197,7 +197,7 @@ class PersonsComponent { @View({ template: ` - + diff --git a/modules/examples/src/routing/inbox-app.ts b/modules/examples/src/routing/inbox-app.ts index 16fb696cdb..f97520c0fe 100644 --- a/modules/examples/src/routing/inbox-app.ts +++ b/modules/examples/src/routing/inbox-app.ts @@ -105,7 +105,7 @@ class InboxDetailCmp { @Component({selector: 'inbox'}) @View({templateUrl: "inbox.html", directives: [NgFor, RouterLink]}) class InboxCmp { - items: List = []; + items: InboxRecord[] = []; ready: boolean = false; constructor(public router: Router, db: DbService) { @@ -120,7 +120,7 @@ class InboxCmp { @Component({selector: 'drafts'}) @View({templateUrl: "drafts.html", directives: [NgFor, RouterLink]}) class DraftsCmp { - items: List = []; + items: InboxRecord[] = []; ready: boolean = false; constructor(public router: Router, db: DbService) { diff --git a/modules/examples/src/template_driven_forms/index.ts b/modules/examples/src/template_driven_forms/index.ts index be61219911..8aa07847cd 100644 --- a/modules/examples/src/template_driven_forms/index.ts +++ b/modules/examples/src/template_driven_forms/index.ts @@ -73,7 +73,7 @@ class CreditCardValidator { class ShowError { formDir; controlPath: string; - errorTypes: List; + errorTypes: string[]; constructor(@Host() formDir: NgForm) { this.formDir = formDir; } diff --git a/modules/examples/src/todo/services/TodoStore.ts b/modules/examples/src/todo/services/TodoStore.ts index 585277d18a..1ea60d3ab8 100644 --- a/modules/examples/src/todo/services/TodoStore.ts +++ b/modules/examples/src/todo/services/TodoStore.ts @@ -24,7 +24,7 @@ export class TodoFactory { // Store manages any generic item that inherits from KeyModel @Injectable() export class Store { - list: List = []; + list: KeyModel[] = []; add(record: KeyModel): void { this.list.push(record); } diff --git a/modules/examples/src/web_workers/images/services/bitmap.ts b/modules/examples/src/web_workers/images/services/bitmap.ts index f0bbecf492..a317656020 100644 --- a/modules/examples/src/web_workers/images/services/bitmap.ts +++ b/modules/examples/src/web_workers/images/services/bitmap.ts @@ -63,7 +63,7 @@ export class BitmapService { return imageData; } - private _swap(data: List, index1: number, index2: number) { + private _swap(data: any[], index1: number, index2: number) { var temp = data[index1]; data[index1] = data[index2]; data[index2] = temp; diff --git a/modules/examples/src/web_workers/todo/services/TodoStore.ts b/modules/examples/src/web_workers/todo/services/TodoStore.ts index 04d3f1c646..3b38ce3395 100644 --- a/modules/examples/src/web_workers/todo/services/TodoStore.ts +++ b/modules/examples/src/web_workers/todo/services/TodoStore.ts @@ -28,7 +28,7 @@ export class TodoFactory { // Store manages any generic item that inherits from KeyModel @Injectable() export class Store { - list: List = []; + list: KeyModel[] = []; add(record: KeyModel): void { this.list.push(record); } diff --git a/modules/examples/src/zippy_component/index.ts b/modules/examples/src/zippy_component/index.ts index f9e457ca75..0b588c1a17 100644 --- a/modules/examples/src/zippy_component/index.ts +++ b/modules/examples/src/zippy_component/index.ts @@ -14,7 +14,7 @@ import {Zippy} from './zippy'; directives: [Zippy, NgFor] }) class ZippyApp { - logs: Array = []; + logs: string[] = []; pushLog(log: string) { this.logs.push(log); } } diff --git a/modules/rtts_assert/test/rtts_assert_spec.ts b/modules/rtts_assert/test/rtts_assert_spec.ts index 93a76a3e4f..4a73e9edc1 100644 --- a/modules/rtts_assert/test/rtts_assert_spec.ts +++ b/modules/rtts_assert/test/rtts_assert_spec.ts @@ -1,7 +1,6 @@ // # Assert.js // A run-time type assertion library for JavaScript. Designed to be used with // [Traceur](https://github.com/google/traceur-compiler). -import {} from '../../angular2/src/test_lib/e2e_util'; import {assert} from '../rtts_assert'; // - [Basic Type Check](#basic-type-check) @@ -358,7 +357,7 @@ export function main() { describe('generics', function() { - it('should pass', function() { var list: Array = []; }); + it('should pass', function() { var list: string[] = []; }); // TODO(tbosch): add assertions based on generics to rtts_assert