diff --git a/modules/@angular/compiler/src/animation/animation_compiler.ts b/modules/@angular/compiler/src/animation/animation_compiler.ts index edb5398701..4d14a0d071 100644 --- a/modules/@angular/compiler/src/animation/animation_compiler.ts +++ b/modules/@angular/compiler/src/animation/animation_compiler.ts @@ -61,7 +61,9 @@ class _AnimationBuilder implements AnimationAstVisitor { } ast.styles.forEach(entry => { - stylesArr.push(o.literalMap(Object.keys(entry).map(key => [key, o.literal(entry[key])]))); + const entries = + Object.keys(entry).map((key): [string, o.Expression] => [key, o.literal(entry[key])]); + stylesArr.push(o.literalMap(entries)); }); return o.importExpr(resolveIdentifier(Identifiers.AnimationStyles)).instantiate([ diff --git a/modules/@angular/compiler/src/animation/animation_parser.ts b/modules/@angular/compiler/src/animation/animation_parser.ts index 70f74e8e45..53fa33938c 100644 --- a/modules/@angular/compiler/src/animation/animation_parser.ts +++ b/modules/@angular/compiler/src/animation/animation_parser.ts @@ -115,13 +115,10 @@ function _parseAnimationStateTransition( stateStyles: {[key: string]: AnimationStylesAst}, errors: AnimationParseError[]): AnimationStateTransitionAst { var styles = new StylesCollection(); - var transitionExprs: any[] /** TODO #9100 */ = []; + var transitionExprs: AnimationStateTransitionExpression[] = []; var transitionStates = transitionStateMetadata.stateChangeExpr.split(/\s*,\s*/); - transitionStates.forEach(expr => { - _parseAnimationTransitionExpr(expr, errors).forEach(transExpr => { - transitionExprs.push(transExpr); - }); - }); + transitionStates.forEach( + expr => { transitionExprs.push(..._parseAnimationTransitionExpr(expr, errors)); }); var entry = _normalizeAnimationEntry(transitionStateMetadata.steps); var animation = _normalizeStyleSteps(entry, stateStyles, errors); var animationAst = _parseTransitionAnimation(animation, 0, styles, stateStyles, errors); @@ -181,8 +178,8 @@ function _normalizeAnimationEntry(entry: CompileAnimationMetadata | CompileAnima function _normalizeStyleMetadata( entry: CompileAnimationStyleMetadata, stateStyles: {[key: string]: AnimationStylesAst}, - errors: AnimationParseError[]): Array<{[key: string]: string | number}> { - var normalizedStyles: any[] /** TODO #9100 */ = []; + errors: AnimationParseError[]): {[key: string]: string | number}[] { + var normalizedStyles: {[key: string]: string | number}[] = []; entry.styles.forEach(styleEntry => { if (isString(styleEntry)) { ListWrapper.addAll( @@ -354,7 +351,6 @@ function _parseAnimationKeyframes( ListWrapper.sort(rawKeyframes, (a, b) => a[0] <= b[0] ? -1 : 1); } - var i: any /** TODO #9100 */; var firstKeyframe = rawKeyframes[0]; if (firstKeyframe[0] != _INITIAL_KEYFRAME) { ListWrapper.insert(rawKeyframes, 0, firstKeyframe = [_INITIAL_KEYFRAME, {}]); @@ -369,7 +365,7 @@ function _parseAnimationKeyframes( } var lastKeyframeStyles = lastKeyframe[1]; - for (i = 1; i <= limit; i++) { + for (let i = 1; i <= limit; i++) { let entry = rawKeyframes[i]; let styles = entry[1]; @@ -380,7 +376,7 @@ function _parseAnimationKeyframes( }); } - for (i = limit - 1; i >= 0; i--) { + for (let i = limit - 1; i >= 0; i--) { let entry = rawKeyframes[i]; let styles = entry[1]; diff --git a/modules/@angular/compiler/src/output/abstract_emitter.ts b/modules/@angular/compiler/src/output/abstract_emitter.ts index 535ca34530..bd96ace81d 100644 --- a/modules/@angular/compiler/src/output/abstract_emitter.ts +++ b/modules/@angular/compiler/src/output/abstract_emitter.ts @@ -368,7 +368,7 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex var useNewLine = ast.entries.length > 1; ctx.print(`{`, useNewLine); ctx.incIndent(); - this.visitAllObjects((entry: any /** TODO #9100 */) => { + this.visitAllObjects(entry => { ctx.print(`${escapeIdentifier(entry[0], this._escapeDollarInStrings, false)}: `); entry[1].visitExpression(this, ctx); }, ast.entries, ctx, ',', useNewLine); @@ -381,12 +381,11 @@ export abstract class AbstractEmitterVisitor implements o.StatementVisitor, o.Ex expressions: o.Expression[], ctx: EmitterVisitorContext, separator: string, newLine: boolean = false): void { this.visitAllObjects( - (expr: any /** TODO #9100 */) => expr.visitExpression(this, ctx), expressions, ctx, - separator, newLine); + expr => expr.visitExpression(this, ctx), expressions, ctx, separator, newLine); } - visitAllObjects( - handler: Function, expressions: any, ctx: EmitterVisitorContext, separator: string, + visitAllObjects( + handler: (t: T) => void, expressions: T[], ctx: EmitterVisitorContext, separator: string, newLine: boolean = false): void { for (var i = 0; i < expressions.length; i++) { if (i > 0) { diff --git a/modules/@angular/compiler/src/output/abstract_js_emitter.ts b/modules/@angular/compiler/src/output/abstract_js_emitter.ts index 326d3cd58e..4a54c07b3b 100644 --- a/modules/@angular/compiler/src/output/abstract_js_emitter.ts +++ b/modules/@angular/compiler/src/output/abstract_js_emitter.ts @@ -144,11 +144,11 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor { } private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void { - this.visitAllObjects((param: any /** TODO #9100 */) => ctx.print(param.name), params, ctx, ','); + this.visitAllObjects(param => ctx.print(param.name), params, ctx, ','); } getBuiltinMethodName(method: o.BuiltinMethod): string { - var name: any /** TODO #9100 */; + var name: string; switch (method) { case o.BuiltinMethod.ConcatArray: name = 'concat'; diff --git a/modules/@angular/compiler/src/output/js_emitter.ts b/modules/@angular/compiler/src/output/js_emitter.ts index 2a34751137..6697d24209 100644 --- a/modules/@angular/compiler/src/output/js_emitter.ts +++ b/modules/@angular/compiler/src/output/js_emitter.ts @@ -20,7 +20,7 @@ export class JavaScriptEmitter implements OutputEmitter { var converter = new JsEmitterVisitor(moduleUrl); var ctx = EmitterVisitorContext.createRoot(exportedVars); converter.visitAllStatements(stmts, ctx); - var srcParts: any[] /** TODO #9100 */ = []; + var srcParts: string[] = []; converter.importsWithPrefixes.forEach((prefix, importedModuleUrl) => { // Note: can't write the real word for import as it screws up system.js auto detection... srcParts.push( diff --git a/modules/@angular/compiler/src/output/output_ast.ts b/modules/@angular/compiler/src/output/output_ast.ts index d64eb1b4c9..e7ef4f80cb 100644 --- a/modules/@angular/compiler/src/output/output_ast.ts +++ b/modules/@angular/compiler/src/output/output_ast.ts @@ -416,7 +416,7 @@ export class LiteralArrayExpr extends Expression { export class LiteralMapExpr extends Expression { public valueType: Type = null; - constructor(public entries: Array>, type: MapType = null) { + constructor(public entries: [string, Expression][], type: MapType = null) { super(type); if (isPresent(type)) { this.valueType = type.valueType; @@ -673,9 +673,11 @@ export class ExpressionTransformer implements StatementVisitor, ExpressionVisito visitLiteralArrayExpr(ast: LiteralArrayExpr, context: any): any { return new LiteralArrayExpr(this.visitAllExpressions(ast.entries, context)); } + visitLiteralMapExpr(ast: LiteralMapExpr, context: any): any { - return new LiteralMapExpr(ast.entries.map( - (entry) => [entry[0], (entry[1]).visitExpression(this, context)])); + const entries = ast.entries.map( + (entry): [string, Expression] => [entry[0], entry[1].visitExpression(this, context), ]); + return new LiteralMapExpr(entries); } visitAllExpressions(exprs: Expression[], context: any): Expression[] { return exprs.map(expr => expr.visitExpression(this, context)); @@ -881,8 +883,7 @@ export function literalArr(values: Expression[], type: Type = null): LiteralArra return new LiteralArrayExpr(values, type); } -export function literalMap( - values: Array>, type: MapType = null): LiteralMapExpr { +export function literalMap(values: [string, Expression][], type: MapType = null): LiteralMapExpr { return new LiteralMapExpr(values, type); } diff --git a/modules/@angular/compiler/src/output/output_jit.ts b/modules/@angular/compiler/src/output/output_jit.ts index 5846671bff..e3683dd6af 100644 --- a/modules/@angular/compiler/src/output/output_jit.ts +++ b/modules/@angular/compiler/src/output/output_jit.ts @@ -26,9 +26,9 @@ class JitEmitterVisitor extends AbstractJsEmitterVisitor { private _evalArgValues: any[] = []; getArgs(): {[key: string]: any} { - var result = {}; + var result: {[key: string]: any} = {}; for (var i = 0; i < this._evalArgNames.length; i++) { - (result as any /** TODO #9100 */)[this._evalArgNames[i]] = this._evalArgValues[i]; + result[this._evalArgNames[i]] = this._evalArgValues[i]; } return result; } diff --git a/modules/@angular/compiler/src/output/ts_emitter.ts b/modules/@angular/compiler/src/output/ts_emitter.ts index 788e4608f6..393689449b 100644 --- a/modules/@angular/compiler/src/output/ts_emitter.ts +++ b/modules/@angular/compiler/src/output/ts_emitter.ts @@ -46,7 +46,7 @@ export class TypeScriptEmitter implements OutputEmitter { var converter = new _TsEmitterVisitor(moduleUrl); var ctx = EmitterVisitorContext.createRoot(exportedVars); converter.visitAllStatements(stmts, ctx); - var srcParts: any[] /** TODO #9100 */ = []; + var srcParts: string[] = []; converter.importsWithPrefixes.forEach((prefix, importedModuleUrl) => { // Note: can't write the real word for import as it screws up system.js auto detection... srcParts.push( @@ -243,7 +243,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor } visitBuiltintType(type: o.BuiltinType, ctx: EmitterVisitorContext): any { - var typeStr: any /** TODO #9100 */; + var typeStr: string; switch (type.name) { case o.BuiltinTypeName.Bool: typeStr = 'boolean'; @@ -307,7 +307,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor } private _visitParams(params: o.FnParam[], ctx: EmitterVisitorContext): void { - this.visitAllObjects((param: any /** TODO #9100 */) => { + this.visitAllObjects(param => { ctx.print(param.name); ctx.print(':'); this.visitType(param.type, ctx); @@ -336,8 +336,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor } if (isPresent(typeParams) && typeParams.length > 0) { ctx.print(`<`); - this.visitAllObjects( - (type: any /** TODO #9100 */) => type.visitType(this, ctx), typeParams, ctx, ','); + this.visitAllObjects(type => type.visitType(this, ctx), typeParams, ctx, ','); ctx.print(`>`); } } diff --git a/modules/@angular/compiler/src/output/value_util.ts b/modules/@angular/compiler/src/output/value_util.ts index 37ac5756ec..a32cd66563 100644 --- a/modules/@angular/compiler/src/output/value_util.ts +++ b/modules/@angular/compiler/src/output/value_util.ts @@ -22,7 +22,7 @@ class _ValueOutputAstTransformer implements ValueTransformer { } visitStringMap(map: {[key: string]: any}, type: o.MapType): o.Expression { - var entries: Array[] = []; + const entries: [string, o.Expression][] = []; Object.keys(map).forEach(key => { entries.push([key, visitValue(map[key], this, null)]); }); return o.literalMap(entries, type); } diff --git a/modules/@angular/compiler/src/util.ts b/modules/@angular/compiler/src/util.ts index e46b8d3653..12978a10c2 100644 --- a/modules/@angular/compiler/src/util.ts +++ b/modules/@angular/compiler/src/util.ts @@ -60,9 +60,8 @@ export class ValueTransformer implements ValueVisitor { return arr.map(value => visitValue(value, this, context)); } visitStringMap(map: {[key: string]: any}, context: any): any { - var result = {}; - Object.keys(map).forEach( - key => { (result as any /** TODO #9100 */)[key] = visitValue(map[key], this, context); }); + var result: {[key: string]: any} = {}; + Object.keys(map).forEach(key => { result[key] = visitValue(map[key], this, context); }); return result; } visitPrimitive(value: any, context: any): any { return value; } diff --git a/modules/@angular/compiler/src/view_compiler/compile_query.ts b/modules/@angular/compiler/src/view_compiler/compile_query.ts index ab7b71e77c..ce3089d161 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_query.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_query.ts @@ -64,7 +64,7 @@ export class CompileQuery { return !this._values.values.some(value => value instanceof ViewQueryValues); } - afterChildren(targetStaticMethod: any /** TODO #9100 */, targetDynamicMethod: CompileMethod) { + afterChildren(targetStaticMethod: CompileMethod, targetDynamicMethod: CompileMethod) { var values = createQueryValues(this._values); var updateStmts = [this.queryList.callMethod('reset', [o.literalArr(values)]).toStmt()]; if (isPresent(this.ownerDirectiveExpression)) { diff --git a/modules/@angular/compiler/src/view_compiler/compile_view.ts b/modules/@angular/compiler/src/view_compiler/compile_view.ts index eab5c45bf3..81720c8a99 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_view.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_view.ts @@ -169,16 +169,16 @@ export class CompileView implements NameResolver { return proxyExpr.callFn(values); } - createLiteralMap(entries: Array>): o.Expression { + createLiteralMap(entries: [string, o.Expression][]): o.Expression { if (entries.length === 0) { return o.importExpr(resolveIdentifier(Identifiers.EMPTY_MAP)); } - var proxyExpr = o.THIS_EXPR.prop(`_map_${this.literalMapCount++}`); - var proxyParams: o.FnParam[] = []; - var proxyReturnEntries: Array> = []; - var values: o.Expression[] = []; + const proxyExpr = o.THIS_EXPR.prop(`_map_${this.literalMapCount++}`); + const proxyParams: o.FnParam[] = []; + const proxyReturnEntries: [string, o.Expression][] = []; + const values: o.Expression[] = []; for (var i = 0; i < entries.length; i++) { - var paramName = `p${i}`; + const paramName = `p${i}`; proxyParams.push(new o.FnParam(paramName)); proxyReturnEntries.push([entries[i][0], o.variable(paramName)]); values.push(entries[i][1]); diff --git a/modules/@angular/compiler/src/view_compiler/event_binder.ts b/modules/@angular/compiler/src/view_compiler/event_binder.ts index 0a56f2b9e6..f68bc0a86f 100644 --- a/modules/@angular/compiler/src/view_compiler/event_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/event_binder.ts @@ -46,7 +46,7 @@ export class CompileEventListener { public eventPhase: string, listenerIndex: number) { this._method = new CompileMethod(compileElement.view); this._methodName = - `_handle_${santitizeEventName(eventName)}_${compileElement.nodeIndex}_${listenerIndex}`; + `_handle_${sanitizeEventName(eventName)}_${compileElement.nodeIndex}_${listenerIndex}`; this._eventParam = new o.FnParam( EventHandlerVars.event.name, o.importType(this.compileElement.view.genConfig.renderTypes.renderEvent)); @@ -96,7 +96,7 @@ export class CompileEventListener { } listenToRenderer() { - var listenExpr: any /** TODO #9100 */; + var listenExpr: o.Expression; var eventListener = o.THIS_EXPR.callMethod( 'eventHandler', [o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.Bind, [o.THIS_EXPR])]); @@ -148,13 +148,15 @@ export class CompileEventListener { export function collectEventListeners( hostEvents: BoundEventAst[], dirs: DirectiveAst[], compileElement: CompileElement): CompileEventListener[] { - var eventListeners: CompileEventListener[] = []; + const eventListeners: CompileEventListener[] = []; + hostEvents.forEach((hostEvent) => { compileElement.view.bindings.push(new CompileBinding(compileElement, hostEvent)); var listener = CompileEventListener.getOrCreate( compileElement, hostEvent.target, hostEvent.name, hostEvent.phase, eventListeners); listener.addAction(hostEvent, null, null); }); + dirs.forEach((directiveAst) => { var directiveInstance = compileElement.instances.get(identifierToken(directiveAst.directive.type).reference); @@ -165,6 +167,7 @@ export function collectEventListeners( listener.addAction(hostEvent, directiveAst.directive, directiveInstance); }); }); + eventListeners.forEach((listener) => listener.finishMethod()); return eventListeners; } @@ -174,6 +177,7 @@ export function bindDirectiveOutputs( eventListeners: CompileEventListener[]) { Object.keys(directiveAst.directive.outputs).forEach(observablePropName => { const eventName = directiveAst.directive.outputs[observablePropName]; + eventListeners.filter(listener => listener.eventName == eventName).forEach((listener) => { listener.listenToDirective(directiveInstance, observablePropName); }); @@ -199,6 +203,6 @@ function convertStmtIntoExpression(stmt: o.Statement): o.Expression { return null; } -function santitizeEventName(name: string): string { +function sanitizeEventName(name: string): string { return name.replace(/[^a-zA-Z_]/g, '_'); } diff --git a/modules/@angular/compiler/src/view_compiler/property_binder.ts b/modules/@angular/compiler/src/view_compiler/property_binder.ts index 192ec98db2..ef34c5fdbf 100644 --- a/modules/@angular/compiler/src/view_compiler/property_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/property_binder.ts @@ -99,10 +99,9 @@ function bindAndWriteToRenderer( view.detectChangesRenderPropertiesMethod.resetDebugInfo(compileElement.nodeIndex, boundProp); var fieldExpr = createBindFieldExpr(bindingIndex); var currValExpr = createCurrValueExpr(bindingIndex); - var renderMethod: string; var oldRenderValue: o.Expression = sanitizedValue(boundProp, fieldExpr); var renderValue: o.Expression = sanitizedValue(boundProp, currValExpr); - var updateStmts: any[] /** TODO #9100 */ = []; + var updateStmts: o.Statement[] = []; var compileMethod = view.detectChangesRenderPropertiesMethod; switch (boundProp.type) { case PropertyBindingType.Property: diff --git a/modules/@angular/compiler/src/view_compiler/util.ts b/modules/@angular/compiler/src/view_compiler/util.ts index 59b66bf26d..2af8469f8c 100644 --- a/modules/@angular/compiler/src/view_compiler/util.ts +++ b/modules/@angular/compiler/src/view_compiler/util.ts @@ -57,7 +57,7 @@ export function getViewFactoryName( } export function createFlatArray(expressions: o.Expression[]): o.Expression { - var lastNonArrayExpressions: any[] /** TODO #9100 */ = []; + var lastNonArrayExpressions: o.Expression[] = []; var result: o.Expression = o.literalArr([]); for (var i = 0; i < expressions.length; i++) { var expr = expressions[i]; diff --git a/modules/@angular/compiler/src/view_compiler/view_builder.ts b/modules/@angular/compiler/src/view_compiler/view_builder.ts index 04632f8788..f832f0727d 100644 --- a/modules/@angular/compiler/src/view_compiler/view_builder.ts +++ b/modules/@angular/compiler/src/view_compiler/view_builder.ts @@ -511,10 +511,13 @@ function createViewFactory( templateUrlInfo = view.component.template.templateUrl; } if (view.viewIndex === 0) { - var animationsExpr = o.literalMap(view.animations.map(entry => [entry.name, entry.fnExp])); - initRenderCompTypeStmts = [new o.IfStmt( + var animationsExpr = o.literalMap( + view.animations.map((entry): [string, o.Expression] => [entry.name, entry.fnExp])); + initRenderCompTypeStmts = [ + new o.IfStmt( renderCompTypeVar.identical(o.NULL_EXPR), - [renderCompTypeVar + [ + renderCompTypeVar .set(ViewConstructorVars.viewUtils.callMethod( 'createRenderComponentType', [ @@ -524,13 +527,16 @@ function createViewFactory( view.styles, animationsExpr, ])) - .toStmt()])]; + .toStmt(), + ]), + ]; } return o - .fn(viewFactoryArgs, initRenderCompTypeStmts.concat([new o.ReturnStatement( - o.variable(viewClass.name) - .instantiate(viewClass.constructorMethod.params.map( - (param) => o.variable(param.name))))]), + .fn(viewFactoryArgs, initRenderCompTypeStmts.concat([ + new o.ReturnStatement(o.variable(viewClass.name) + .instantiate(viewClass.constructorMethod.params.map( + (param) => o.variable(param.name)))), + ]), o.importType(resolveIdentifier(Identifiers.AppView), [getContextType(view)])) .toDeclStmt(view.viewFactory.name, [o.StmtModifier.Final]); } diff --git a/modules/@angular/compiler/test/animation/animation_compiler_spec.ts b/modules/@angular/compiler/test/animation/animation_compiler_spec.ts index ca758524fb..8fe0d326d6 100644 --- a/modules/@angular/compiler/test/animation/animation_compiler_spec.ts +++ b/modules/@angular/compiler/test/animation/animation_compiler_spec.ts @@ -15,7 +15,7 @@ import {CompileMetadataResolver} from '../../src/metadata_resolver'; export function main() { describe('RuntimeAnimationCompiler', () => { - var resolver: any /** TODO #9100 */; + var resolver: CompileMetadataResolver; beforeEach( inject([CompileMetadataResolver], (res: CompileMetadataResolver) => { resolver = res; })); diff --git a/modules/@angular/compiler/test/animation/animation_parser_spec.ts b/modules/@angular/compiler/test/animation/animation_parser_spec.ts index a726fd23fb..69dcd54777 100644 --- a/modules/@angular/compiler/test/animation/animation_parser_spec.ts +++ b/modules/@angular/compiler/test/animation/animation_parser_spec.ts @@ -28,9 +28,9 @@ export function main() { (keyframe: AnimationKeyframeAst): {[key: string]: string | number} => combineStyles(keyframe.styles); - var collectStepStyles = (step: AnimationStepAst): Array<{[key: string]: string | number}> => { + var collectStepStyles = (step: AnimationStepAst): {[key: string]: string | number}[] => { var keyframes = step.keyframes; - var styles: any[] /** TODO #9100 */ = []; + var styles: {[key: string]: string | number}[] = []; if (step.startingStyles.styles.length > 0) { styles.push(combineStyles(step.startingStyles)); } @@ -38,7 +38,7 @@ export function main() { return styles; }; - var resolver: any /** TODO #9100 */; + var resolver: CompileMetadataResolver; beforeEach( inject([CompileMetadataResolver], (res: CompileMetadataResolver) => { resolver = res; })); diff --git a/modules/@angular/compiler/test/css_parser/css_lexer_spec.ts b/modules/@angular/compiler/test/css_parser/css_lexer_spec.ts index 781a44a2d6..2c4d656113 100644 --- a/modules/@angular/compiler/test/css_parser/css_lexer_spec.ts +++ b/modules/@angular/compiler/test/css_parser/css_lexer_spec.ts @@ -275,7 +275,7 @@ export function main() { it('should throw an error if a selector is being parsed while in the wrong mode', () => { var cssCode = '.class > tag'; - var capturedMessage: any /** TODO #9100 */; + var capturedMessage: string; try { tokenize(cssCode, false, CssLexerMode.STYLE_BLOCK); } catch (e) { @@ -298,7 +298,7 @@ export function main() { describe('Attribute Mode', () => { it('should consider attribute selectors as valid input and throw when an invalid modifier is used', () => { - function tokenizeAttr(modifier: any /** TODO #9100 */) { + function tokenizeAttr(modifier: string) { var cssCode = 'value' + modifier + '=\'something\''; return tokenize(cssCode, false, CssLexerMode.ATTRIBUTE_SELECTOR); } diff --git a/modules/@angular/compiler/test/directive_lifecycle_spec.ts b/modules/@angular/compiler/test/directive_lifecycle_spec.ts index aaee9d17ed..65354c0e91 100644 --- a/modules/@angular/compiler/test/directive_lifecycle_spec.ts +++ b/modules/@angular/compiler/test/directive_lifecycle_spec.ts @@ -7,8 +7,8 @@ */ import {hasLifecycleHook} from '@angular/compiler/src/lifecycle_reflector'; -import {LifecycleHooks} from '@angular/core/src/metadata/lifecycle_hooks'; -import {describe, expect, it} from '@angular/core/testing/testing_internal'; +import {SimpleChanges} from '@angular/core'; +import {LifecycleHooks as Hooks} from '@angular/core/src/metadata/lifecycle_hooks'; export function main() { describe('Create Directive', () => { @@ -16,92 +16,81 @@ export function main() { describe('ngOnChanges', () => { it('should be true when the directive has the ngOnChanges method', () => { - expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveWithOnChangesMethod)) - .toBe(true); + expect(hasLifecycleHook(Hooks.OnChanges, DirectiveWithOnChangesMethod)).toBe(true); }); - it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveNoHooks)).toBe(false); - }); + it('should be false otherwise', + () => { expect(hasLifecycleHook(Hooks.OnChanges, DirectiveNoHooks)).toBe(false); }); }); describe('ngOnDestroy', () => { it('should be true when the directive has the ngOnDestroy method', () => { - expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveWithOnDestroyMethod)) - .toBe(true); + expect(hasLifecycleHook(Hooks.OnDestroy, DirectiveWithOnDestroyMethod)).toBe(true); }); - it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveNoHooks)).toBe(false); - }); + it('should be false otherwise', + () => { expect(hasLifecycleHook(Hooks.OnDestroy, DirectiveNoHooks)).toBe(false); }); }); describe('ngOnInit', () => { - it('should be true when the directive has the ngOnInit method', () => { - expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveWithOnInitMethod)).toBe(true); - }); + it('should be true when the directive has the ngOnInit method', + () => { expect(hasLifecycleHook(Hooks.OnInit, DirectiveWithOnInitMethod)).toBe(true); }); - it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveNoHooks)).toBe(false); - }); + it('should be false otherwise', + () => { expect(hasLifecycleHook(Hooks.OnInit, DirectiveNoHooks)).toBe(false); }); }); describe('ngDoCheck', () => { it('should be true when the directive has the ngDoCheck method', () => { - expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveWithOnCheckMethod)).toBe(true); + expect(hasLifecycleHook(Hooks.DoCheck, DirectiveWithOnCheckMethod)).toBe(true); }); - it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveNoHooks)).toBe(false); - }); + it('should be false otherwise', + () => { expect(hasLifecycleHook(Hooks.DoCheck, DirectiveNoHooks)).toBe(false); }); }); describe('ngAfterContentInit', () => { it('should be true when the directive has the ngAfterContentInit method', () => { - expect(hasLifecycleHook( - LifecycleHooks.AfterContentInit, DirectiveWithAfterContentInitMethod)) + expect(hasLifecycleHook(Hooks.AfterContentInit, DirectiveWithAfterContentInitMethod)) .toBe(true); }); it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.AfterContentInit, DirectiveNoHooks)).toBe(false); + expect(hasLifecycleHook(Hooks.AfterContentInit, DirectiveNoHooks)).toBe(false); }); }); describe('ngAfterContentChecked', () => { it('should be true when the directive has the ngAfterContentChecked method', () => { - expect(hasLifecycleHook( - LifecycleHooks.AfterContentChecked, DirectiveWithAfterContentCheckedMethod)) + expect( + hasLifecycleHook(Hooks.AfterContentChecked, DirectiveWithAfterContentCheckedMethod)) .toBe(true); }); it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked, DirectiveNoHooks)) - .toBe(false); + expect(hasLifecycleHook(Hooks.AfterContentChecked, DirectiveNoHooks)).toBe(false); }); }); describe('ngAfterViewInit', () => { it('should be true when the directive has the ngAfterViewInit method', () => { - expect(hasLifecycleHook(LifecycleHooks.AfterViewInit, DirectiveWithAfterViewInitMethod)) + expect(hasLifecycleHook(Hooks.AfterViewInit, DirectiveWithAfterViewInitMethod)) .toBe(true); }); - it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.AfterViewInit, DirectiveNoHooks)).toBe(false); - }); + it('should be false otherwise', + () => { expect(hasLifecycleHook(Hooks.AfterViewInit, DirectiveNoHooks)).toBe(false); }); }); describe('ngAfterViewChecked', () => { it('should be true when the directive has the ngAfterViewChecked method', () => { - expect(hasLifecycleHook( - LifecycleHooks.AfterViewChecked, DirectiveWithAfterViewCheckedMethod)) + expect(hasLifecycleHook(Hooks.AfterViewChecked, DirectiveWithAfterViewCheckedMethod)) .toBe(true); }); it('should be false otherwise', () => { - expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked, DirectiveNoHooks)).toBe(false); + expect(hasLifecycleHook(Hooks.AfterViewChecked, DirectiveNoHooks)).toBe(false); }); }); }); @@ -111,7 +100,7 @@ export function main() { class DirectiveNoHooks {} class DirectiveWithOnChangesMethod { - ngOnChanges(_: any /** TODO #9100 */) {} + ngOnChanges(_: SimpleChanges) {} } class DirectiveWithOnInitMethod { diff --git a/modules/@angular/compiler/test/output/output_emitter_spec.ts b/modules/@angular/compiler/test/output/output_emitter_spec.ts index 72ce118eba..18408b71a1 100644 --- a/modules/@angular/compiler/test/output/output_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/output_emitter_spec.ts @@ -43,7 +43,7 @@ export function main() { describe('output emitter', () => { outputDefs.forEach((outputDef) => { describe(`${outputDef['name']}`, () => { - var expressions: any /** TODO #9100 */; + var expressions: {[k: string]: any}; beforeEach(() => { expressions = outputDef['getExpressions']()(); }); it('should support literals', () => { @@ -109,13 +109,16 @@ export function main() { }); describe('operators', () => { - var ops: any /** TODO #9100 */; - var aObj: any /** TODO #9100 */, bObj: any /** TODO #9100 */; + var ops: {[k: string]: Function}; + var aObj: any; + var bObj: any; + beforeEach(() => { ops = expressions['operators']; - aObj = new Object(); - bObj = new Object(); + aObj = {}; + bObj = {}; }); + it('should support ==', () => { expect(ops['=='](aObj, aObj)).toBe(true); expect(ops['=='](aObj, bObj)).toBe(false); diff --git a/modules/@angular/compiler/test/resource_loader_mock_spec.ts b/modules/@angular/compiler/test/resource_loader_mock_spec.ts index cda7fde654..a7e28db157 100644 --- a/modules/@angular/compiler/test/resource_loader_mock_spec.ts +++ b/modules/@angular/compiler/test/resource_loader_mock_spec.ts @@ -53,7 +53,7 @@ export function main() { it('should return an error from the definitions', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { var url = '/foo'; - var response: any /** TODO #9100 */ = null; + var response: string = null; resourceLoader.when(url, response); expectResponse(resourceLoader.get(url), url, response, () => async.done()); resourceLoader.flush(); @@ -71,7 +71,7 @@ export function main() { it('should return an error from the expectations', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { var url = '/foo'; - var response: any /** TODO #9100 */ = null; + var response: string = null; resourceLoader.expect(url, response); expectResponse(resourceLoader.get(url), url, response, () => async.done()); resourceLoader.flush(); diff --git a/modules/@angular/compiler/test/style_url_resolver_spec.ts b/modules/@angular/compiler/test/style_url_resolver_spec.ts index 0e4a988534..04f63c5cb4 100644 --- a/modules/@angular/compiler/test/style_url_resolver_spec.ts +++ b/modules/@angular/compiler/test/style_url_resolver_spec.ts @@ -11,7 +11,7 @@ import {UrlResolver} from '@angular/compiler/src/url_resolver'; export function main() { describe('extractStyleUrls', () => { - var urlResolver: any /** TODO #9100 */; + var urlResolver: UrlResolver; beforeEach(() => { urlResolver = new UrlResolver(); }); diff --git a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts index 33231ef201..98c10033e8 100644 --- a/modules/@angular/compiler/test/template_parser/template_parser_spec.ts +++ b/modules/@angular/compiler/test/template_parser/template_parser_spec.ts @@ -1146,7 +1146,7 @@ Reference "#a" is defined several times ("
]#a>
}); describe('content projection', () => { - var compCounter: any /** TODO #9100 */; + var compCounter: number; beforeEach(() => { compCounter = 0; }); function createComp( diff --git a/modules/@angular/compiler/testing/resource_loader_mock.ts b/modules/@angular/compiler/testing/resource_loader_mock.ts index 65ee7bf63d..3d65ff4196 100644 --- a/modules/@angular/compiler/testing/resource_loader_mock.ts +++ b/modules/@angular/compiler/testing/resource_loader_mock.ts @@ -67,7 +67,7 @@ export class MockResourceLoader extends ResourceLoader { verifyNoOutstandingExpectations() { if (this._expectations.length === 0) return; - var urls: any[] /** TODO #9100 */ = []; + var urls: string[] = []; for (var i = 0; i < this._expectations.length; i++) { var expectation = this._expectations[i]; urls.push(expectation.url); diff --git a/modules/@angular/facade/src/async.ts b/modules/@angular/facade/src/async.ts index ac98efe207..feaa9c05af 100644 --- a/modules/@angular/facade/src/async.ts +++ b/modules/@angular/facade/src/async.ts @@ -78,14 +78,14 @@ export class EventEmitter extends Subject { emit(value?: T) { super.next(value); } subscribe(generatorOrNext?: any, error?: any, complete?: any): any { - let schedulerFn: any /** TODO #9100 */; - let errorFn = (err: any): any /** TODO #9100 */ => null; - let completeFn = (): any /** TODO #9100 */ => null; + let schedulerFn: (t: any) => any; + let errorFn = (err: any): any => null; + let completeFn = (): any => null; if (generatorOrNext && typeof generatorOrNext === 'object') { - schedulerFn = this.__isAsync ? (value: any /** TODO #9100 */) => { + schedulerFn = this.__isAsync ? (value: any) => { setTimeout(() => generatorOrNext.next(value)); - } : (value: any /** TODO #9100 */) => { generatorOrNext.next(value); }; + } : (value: any) => { generatorOrNext.next(value); }; if (generatorOrNext.error) { errorFn = this.__isAsync ? (err) => { setTimeout(() => generatorOrNext.error(err)); } : @@ -97,9 +97,8 @@ export class EventEmitter extends Subject { () => { generatorOrNext.complete(); }; } } else { - schedulerFn = this.__isAsync ? (value: any /** TODO #9100 */) => { - setTimeout(() => generatorOrNext(value)); - } : (value: any /** TODO #9100 */) => { generatorOrNext(value); }; + schedulerFn = this.__isAsync ? (value: any) => { setTimeout(() => generatorOrNext(value)); } : + (value: any) => { generatorOrNext(value); }; if (error) { errorFn =