refactor(TypeScript): Add noImplicitAny

We automatically insert explicit 'any's where needed. These need to be
addressed as in #9100.

Fixes #4924
This commit is contained in:
ScottSWu
2016-06-08 15:45:15 -07:00
parent 87d824e1b4
commit 86fbd50c3d
305 changed files with 2338 additions and 2337 deletions

View File

@ -25,7 +25,7 @@ import {CompileMetadataResolver} from '../../src/metadata_resolver';
export function main() {
describe('RuntimeAnimationCompiler', () => {
var resolver;
var resolver: any /** TODO #9100 */;
beforeEach(inject([CompileMetadataResolver], (res: CompileMetadataResolver) => {
resolver = res;
}));

View File

@ -52,7 +52,7 @@ export function main() {
describe('parseAnimationEntry', () => {
var combineStyles = (styles: AnimationStylesAst): {[key: string]: string | number} => {
var flatStyles: {[key: string]: string | number} = {};
styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val, prop) => { flatStyles[prop] = val; }));
styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val: any /** TODO #9100 */, prop: any /** TODO #9100 */) => { flatStyles[prop] = val; }));
return flatStyles;
};
@ -62,7 +62,7 @@ export function main() {
var collectStepStyles = (step: AnimationStepAst): Array<{[key: string]: string | number}> => {
var keyframes = step.keyframes;
var styles = [];
var styles: any[] /** TODO #9100 */ = [];
if (step.startingStyles.styles.length > 0) {
styles.push(combineStyles(step.startingStyles));
}
@ -70,7 +70,7 @@ export function main() {
return styles;
};
var resolver;
var resolver: any /** TODO #9100 */;
beforeEach(inject([CompileMetadataResolver], (res: CompileMetadataResolver) => {
resolver = res;
}));

View File

@ -20,12 +20,12 @@ import {
} from '@angular/compiler/src/css/lexer';
export function main() {
function tokenize(code, trackComments: boolean = false,
function tokenize(code: any /** TODO #9100 */, trackComments: boolean = false,
mode: CssLexerMode = CssLexerMode.ALL): CssToken[] {
var scanner = new CssLexer().scan(code, trackComments);
scanner.setMode(mode);
var tokens = [];
var tokens: any[] /** TODO #9100 */ = [];
var output = scanner.scan();
while (output != null) {
var error = output.error;
@ -280,7 +280,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;
var capturedMessage: any /** TODO #9100 */;
try {
tokenize(cssCode, false, CssLexerMode.STYLE_BLOCK);
} catch (e) {
@ -304,7 +304,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) {
function tokenizeAttr(modifier: any /** TODO #9100 */) {
var cssCode = "value" + modifier + "='something'";
return tokenize(cssCode, false, CssLexerMode.ATTRIBUTE_SELECTOR);
}
@ -322,7 +322,7 @@ export function main() {
describe('Media Query Mode', () => {
it('should validate media queries with a reduced subset of valid characters', () => {
function tokenizeQuery(code) { return tokenize(code, false, CssLexerMode.MEDIA_QUERY); }
function tokenizeQuery(code: any /** TODO #9100 */) { return tokenize(code, false, CssLexerMode.MEDIA_QUERY); }
// the reason why the numbers are so high is because MediaQueries keep
// track of the whitespace values
@ -341,7 +341,7 @@ export function main() {
describe('Pseudo Selector Mode', () => {
it('should validate pseudo selector identifiers with a reduced subset of valid characters',
() => {
function tokenizePseudo(code) {
function tokenizePseudo(code: any /** TODO #9100 */) {
return tokenize(code, false, CssLexerMode.PSEUDO_SELECTOR);
}
@ -358,7 +358,7 @@ export function main() {
describe('Pseudo Selector Mode', () => {
it('should validate pseudo selector identifiers with a reduced subset of valid characters',
() => {
function tokenizePseudo(code) {
function tokenizePseudo(code: any /** TODO #9100 */) {
return tokenize(code, false, CssLexerMode.PSEUDO_SELECTOR);
}
@ -374,7 +374,7 @@ export function main() {
describe('Style Block Mode', () => {
it('should style blocks with a reduced subset of valid characters', () => {
function tokenizeStyles(code) { return tokenize(code, false, CssLexerMode.STYLE_BLOCK); }
function tokenizeStyles(code: any /** TODO #9100 */) { return tokenize(code, false, CssLexerMode.STYLE_BLOCK); }
expect(tokenizeStyles(`
key: value;

View File

@ -33,7 +33,7 @@ import {
import {CssLexer} from '@angular/compiler/src/css/lexer';
export function assertTokens(tokens, valuesArr) {
export function assertTokens(tokens: any /** TODO #9100 */, valuesArr: any /** TODO #9100 */) {
for (var i = 0; i < tokens.length; i++) {
expect(tokens[i].strValue == valuesArr[i]);
}
@ -41,14 +41,14 @@ export function assertTokens(tokens, valuesArr) {
export function main() {
describe('CssParser', () => {
function parse(css): ParsedCssResult {
function parse(css: any /** TODO #9100 */): ParsedCssResult {
var lexer = new CssLexer();
var scanner = lexer.scan(css);
var parser = new CssParser(scanner, 'some-fake-file-name.css');
return parser.parse();
}
function makeAST(css): CssStyleSheetAST {
function makeAST(css: any /** TODO #9100 */): CssStyleSheetAST {
var output = parse(css);
var errors = output.errors;
if (errors.length > 0) {

View File

@ -37,7 +37,7 @@ import {
import {CssLexer} from '@angular/compiler/src/css/lexer';
function _assertTokens(tokens, valuesArr) {
function _assertTokens(tokens: any /** TODO #9100 */, valuesArr: any /** TODO #9100 */) {
for (var i = 0; i < tokens.length; i++) {
expect(tokens[i].strValue == valuesArr[i]);
}
@ -46,16 +46,16 @@ function _assertTokens(tokens, valuesArr) {
class MyVisitor implements CssASTVisitor {
captures: {[key: string]: any[]} = {};
_capture(method, ast, context) {
_capture(method: any /** TODO #9100 */, ast: any /** TODO #9100 */, context: any /** TODO #9100 */) {
this.captures[method] = isPresent(this.captures[method]) ? this.captures[method] : [];
this.captures[method].push([ast, context]);
}
constructor(ast: CssStyleSheetAST, context?: any) { ast.visit(this, context); }
visitCssValue(ast, context?: any): void { this._capture("visitCssValue", ast, context); }
visitCssValue(ast: any /** TODO #9100 */, context?: any): void { this._capture("visitCssValue", ast, context); }
visitInlineCssRule(ast, context?: any): void {
visitInlineCssRule(ast: any /** TODO #9100 */, context?: any): void {
this._capture("visitInlineCssRule", ast, context);
}
@ -118,7 +118,7 @@ export function main() {
}
describe('CSS parsing and visiting', () => {
var ast;
var ast: any /** TODO #9100 */;
var context = {};
beforeEach(() => {

View File

@ -113,7 +113,7 @@ export function main() {
class DirectiveNoHooks {}
class DirectiveWithOnChangesMethod {
ngOnChanges(_) {}
ngOnChanges(_: any /** TODO #9100 */) {}
}
class DirectiveWithOnInitMethod {

View File

@ -36,7 +36,7 @@ export function main() {
describe('inline template', () => {
it('should store the template',
inject([AsyncTestCompleter, DirectiveNormalizer],
(async, normalizer: DirectiveNormalizer) => {
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null,
template: 'a',
@ -53,7 +53,7 @@ export function main() {
it('should resolve styles on the annotation against the moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer],
(async, normalizer: DirectiveNormalizer) => {
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null,
template: '',
@ -69,7 +69,7 @@ export function main() {
it('should resolve styles in the template against the moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer],
(async, normalizer: DirectiveNormalizer) => {
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null,
template: '<style>@import test.css</style>',
@ -85,7 +85,7 @@ export function main() {
it('should use ViewEncapsulation.Emulated by default',
inject([AsyncTestCompleter, DirectiveNormalizer],
(async, normalizer: DirectiveNormalizer) => {
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer) => {
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null,
template: '',
@ -101,7 +101,7 @@ export function main() {
it('should use default encapsulation provided by CompilerConfig',
inject([AsyncTestCompleter, CompilerConfig , DirectiveNormalizer],
(async, config: CompilerConfig, normalizer: DirectiveNormalizer) => {
(async: any /** TODO #9100 */, config: CompilerConfig, normalizer: DirectiveNormalizer) => {
config.defaultEncapsulation = ViewEncapsulation.None;
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null,
@ -121,7 +121,7 @@ export function main() {
it('should load a template from a url that is resolved against moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
(async, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
xhr.expect('package:some/module/sometplurl.html', 'a');
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null,
@ -141,7 +141,7 @@ export function main() {
it('should resolve styles on the annotation against the moduleUrl',
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
(async, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
xhr.expect('package:some/module/tpl/sometplurl.html', '');
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({
encapsulation: null,
@ -159,7 +159,7 @@ export function main() {
it('should resolve styles in the template against the templateUrl',
inject([AsyncTestCompleter, DirectiveNormalizer, XHR],
(async, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
(async: any /** TODO #9100 */, normalizer: DirectiveNormalizer, xhr: MockXHR) => {
xhr.expect('package:some/module/tpl/sometplurl.html',
'<style>@import test.css</style>');
normalizer.normalizeTemplate(dirType, new CompileTemplateMetadata({

View File

@ -27,22 +27,22 @@ class SomeChildDirective extends SomeDirective {
@Directive({selector: 'someDirective', inputs: ['c']})
class SomeDirectiveWithInputs {
@Input() a;
@Input("renamed") b;
c;
@Input() a: any /** TODO #9100 */;
@Input("renamed") b: any /** TODO #9100 */;
c: any /** TODO #9100 */;
}
@Directive({selector: 'someDirective', outputs: ['c']})
class SomeDirectiveWithOutputs {
@Output() a;
@Output("renamed") b;
c;
@Output() a: any /** TODO #9100 */;
@Output("renamed") b: any /** TODO #9100 */;
c: any /** TODO #9100 */;
}
@Directive({selector: 'someDirective', outputs: ['a']})
class SomeDirectiveWithDuplicateOutputs {
@Output() a;
@Output() a: any /** TODO #9100 */;
}
@Directive({selector: 'someDirective', properties: ['a']})
@ -56,23 +56,23 @@ class SomeDirectiveWithEvents {
@Directive({selector: 'someDirective'})
class SomeDirectiveWithSetterProps {
@Input("renamed")
set a(value) {
set a(value: any /** TODO #9100 */) {
}
}
@Directive({selector: 'someDirective'})
class SomeDirectiveWithGetterOutputs {
@Output("renamed")
get a() {
get a(): any /** TODO #9100 */ {
return null;
}
}
@Directive({selector: 'someDirective', host: {'[c]': 'c'}})
class SomeDirectiveWithHostBindings {
@HostBinding() a;
@HostBinding("renamed") b;
c;
@HostBinding() a: any /** TODO #9100 */;
@HostBinding("renamed") b: any /** TODO #9100 */;
c: any /** TODO #9100 */;
}
@Directive({selector: 'someDirective', host: {'(c)': 'onC()'}})
@ -81,32 +81,32 @@ class SomeDirectiveWithHostListeners {
onA() {
}
@HostListener('b', ['$event.value'])
onB(value) {
onB(value: any /** TODO #9100 */) {
}
}
@Directive({selector: 'someDirective', queries: {"cs": new ContentChildren("c")}})
class SomeDirectiveWithContentChildren {
@ContentChildren("a") as: any;
c;
c: any /** TODO #9100 */;
}
@Directive({selector: 'someDirective', queries: {"cs": new ViewChildren("c")}})
class SomeDirectiveWithViewChildren {
@ViewChildren("a") as: any;
c;
c: any /** TODO #9100 */;
}
@Directive({selector: 'someDirective', queries: {"c": new ContentChild("c")}})
class SomeDirectiveWithContentChild {
@ContentChild("a") a: any;
c;
c: any /** TODO #9100 */;
}
@Directive({selector: 'someDirective', queries: {"c": new ViewChild("c")}})
class SomeDirectiveWithViewChild {
@ViewChild("a") a: any;
c;
c: any /** TODO #9100 */;
}
class SomeDirectiveWithoutMetadata {}

View File

@ -8,41 +8,41 @@ function lex(text: string): any[] {
return new Lexer().tokenize(text);
}
function expectToken(token, index) {
function expectToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */) {
expect(token instanceof Token).toBe(true);
expect(token.index).toEqual(index);
}
function expectCharacterToken(token, index, character) {
function expectCharacterToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, character: any /** TODO #9100 */) {
expect(character.length).toBe(1);
expectToken(token, index);
expect(token.isCharacter(StringWrapper.charCodeAt(character, 0))).toBe(true);
}
function expectOperatorToken(token, index, operator) {
function expectOperatorToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, operator: any /** TODO #9100 */) {
expectToken(token, index);
expect(token.isOperator(operator)).toBe(true);
}
function expectNumberToken(token, index, n) {
function expectNumberToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, n: any /** TODO #9100 */) {
expectToken(token, index);
expect(token.isNumber()).toBe(true);
expect(token.toNumber()).toEqual(n);
}
function expectStringToken(token, index, str) {
function expectStringToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, str: any /** TODO #9100 */) {
expectToken(token, index);
expect(token.isString()).toBe(true);
expect(token.toString()).toEqual(str);
}
function expectIdentifierToken(token, index, identifier) {
function expectIdentifierToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, identifier: any /** TODO #9100 */) {
expectToken(token, index);
expect(token.isIdentifier()).toBe(true);
expect(token.toString()).toEqual(identifier);
}
function expectKeywordToken(token, index, keyword) {
function expectKeywordToken(token: any /** TODO #9100 */, index: any /** TODO #9100 */, keyword: any /** TODO #9100 */) {
expectToken(token, index);
expect(token.isKeyword()).toBe(true);
expect(token.toString()).toEqual(keyword);

View File

@ -8,23 +8,23 @@ import {BindingPipe, LiteralPrimitive, AST} from '@angular/compiler/src/expressi
export function main() {
function createParser() { return new Parser(new Lexer()); }
function parseAction(text, location = null): any {
function parseAction(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
return createParser().parseAction(text, location);
}
function parseBinding(text, location = null): any {
function parseBinding(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
return createParser().parseBinding(text, location);
}
function parseTemplateBindings(text, location = null): any {
function parseTemplateBindings(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
return createParser().parseTemplateBindings(text, location).templateBindings;
}
function parseInterpolation(text, location = null): any {
function parseInterpolation(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
return createParser().parseInterpolation(text, location);
}
function parseSimpleBinding(text, location = null): any {
function parseSimpleBinding(text: any /** TODO #9100 */, location: any /** TODO #9100 */ = null): any {
return createParser().parseSimpleBinding(text, location);
}
@ -48,9 +48,9 @@ export function main() {
expect(unparse(ast)).toEqual(expected);
}
function expectActionError(text) { return expect(() => parseAction(text)); }
function expectActionError(text: any /** TODO #9100 */) { return expect(() => parseAction(text)); }
function expectBindingError(text) { return expect(() => parseBinding(text)); }
function expectBindingError(text: any /** TODO #9100 */) { return expect(() => parseBinding(text)); }
describe("parser", () => {
describe("parseAction", () => {

View File

@ -18,7 +18,7 @@ export function main() {
let htmlParser = new HtmlParser();
let msgs = '';
StringMapWrapper.forEach(messages, (v, k) => msgs += `<msg id="${k}">${v}</msg>`);
StringMapWrapper.forEach(messages, (v: any /** TODO #9100 */, k: any /** TODO #9100 */) => msgs += `<msg id="${k}">${v}</msg>`);
let res = deserializeXmb(`<message-bundle>${msgs}</message-bundle>`, 'someUrl');
return new I18nHtmlParser(htmlParser, parser, res.content, res.messages, implicitTags,

View File

@ -43,7 +43,7 @@ export function main() {
var injector: Injector;
var sharedStylesHost: SharedStylesHost;
beforeEach(inject([Injector, SharedStylesHost], (_injector, _sharedStylesHost) => {
beforeEach(inject([Injector, SharedStylesHost], (_injector: any /** TODO #9100 */, _sharedStylesHost: any /** TODO #9100 */) => {
injector = _injector;
sharedStylesHost = _sharedStylesHost;
}));

View File

@ -26,7 +26,7 @@ import {
export function
main() {
var outputDefs = [];
var outputDefs: any[] /** TODO #9100 */ = [];
outputDefs.push({
'getExpressions': () => interpretStatements(codegenStmts, 'getExpressions',
new DynamicClassInstanceFactory()),
@ -50,7 +50,7 @@ import {
describe('output emitter', () => {
outputDefs.forEach((outputDef) => {
describe(`${outputDef['name']}`, () => {
var expressions;
var expressions: any /** TODO #9100 */;
beforeEach(() => { expressions = outputDef['getExpressions']()(); });
it('should support literals', () => {
@ -116,8 +116,8 @@ import {
});
describe('operators', () => {
var ops;
var aObj, bObj;
var ops: any /** TODO #9100 */;
var aObj: any /** TODO #9100 */, bObj: any /** TODO #9100 */;
beforeEach(() => {
ops = expressions['operators'];
aObj = new Object();

View File

@ -10,7 +10,7 @@ import * as o from '@angular/compiler/src/output/output_ast';
export class ExternalClass {
changeable: any;
constructor(public data: any) { this.changeable = data; }
someMethod(a) { return {'param': a, 'data': this.data}; }
someMethod(a: any /** TODO #9100 */) { return {'param': a, 'data': this.data}; }
}
var testDataIdentifier = new CompileIdentifierMetadata({
@ -271,5 +271,5 @@ class _InterpretiveDynamicClass extends ExternalClass implements DynamicInstance
public getters: Map<string, Function>, public methods: Map<string, Function>) {
super(args[0]);
}
childMethod(a) { return this.methods.get('childMethod')(a); }
childMethod(a: any /** TODO #9100 */) { return this.methods.get('childMethod')(a); }
}

View File

@ -2,16 +2,16 @@ import {isString, isPresent} from '../../src/facade/lang';
const SVG_PREFIX = ':svg:';
var document = typeof global['document'] == 'object' ? global['document'] : null;
var document = typeof (global as any /** TODO #???? */)['document'] == 'object' ? (global as any /** TODO #???? */)['document'] : null;
export function extractSchema(): Map<string, string[]> {
var SVGGraphicsElement = global['SVGGraphicsElement'];
var SVGAnimationElement = global['SVGAnimationElement'];
var SVGGeometryElement = global['SVGGeometryElement'];
var SVGComponentTransferFunctionElement = global['SVGComponentTransferFunctionElement'];
var SVGGradientElement = global['SVGGradientElement'];
var SVGTextContentElement = global['SVGTextContentElement'];
var SVGTextPositioningElement = global['SVGTextPositioningElement'];
var SVGGraphicsElement = (global as any /** TODO #???? */)['SVGGraphicsElement'];
var SVGAnimationElement = (global as any /** TODO #???? */)['SVGAnimationElement'];
var SVGGeometryElement = (global as any /** TODO #???? */)['SVGGeometryElement'];
var SVGComponentTransferFunctionElement = (global as any /** TODO #???? */)['SVGComponentTransferFunctionElement'];
var SVGGradientElement = (global as any /** TODO #???? */)['SVGGradientElement'];
var SVGTextContentElement = (global as any /** TODO #???? */)['SVGTextContentElement'];
var SVGTextPositioningElement = (global as any /** TODO #???? */)['SVGTextPositioningElement'];
if (!document || !SVGGraphicsElement) return null;
var descMap: Map<string, string[]> = new Map();
var visited: {[name: string]: boolean} = {};
@ -44,7 +44,7 @@ export function extractSchema(): Map<string, string[]> {
var keys = Object.getOwnPropertyNames(window).filter(
k => k.endsWith('Element') && (k.startsWith('HTML') || k.startsWith('SVG')));
keys.sort();
keys.forEach(name => extractRecursiveProperties(visited, descMap, window[name]));
keys.forEach(name => extractRecursiveProperties(visited, descMap, (window as any /** TODO #???? */)[name]));
return descMap;
}

View File

@ -6,7 +6,7 @@ import {el} from '@angular/platform-browser/testing';
export function main() {
describe('SelectorMatcher', () => {
var matcher, selectableCollector, s1, s2, s3, s4;
var matcher: any /** TODO #9100 */, selectableCollector: any /** TODO #9100 */, s1: any /** TODO #9100 */, s2: any /** TODO #9100 */, s3: any /** TODO #9100 */, s4: any /** TODO #9100 */;
var matched: any[];
function reset() { matched = []; }
@ -14,7 +14,7 @@ export function main() {
beforeEach(() => {
reset();
s1 = s2 = s3 = s4 = null;
selectableCollector = (selector, context) => {
selectableCollector = (selector: any /** TODO #9100 */, context: any /** TODO #9100 */) => {
matched.push(selector);
matched.push(context);
};

View File

@ -186,8 +186,8 @@ export function main() {
describe('processRules', () => {
describe('parse rules', () => {
function captureRules(input: string): CssRule[] {
var result = [];
processRules(input, (cssRule) => {
var result: any[] /** TODO #9100 */ = [];
processRules(input, (cssRule: any /** TODO #9100 */) => {
result.push(cssRule);
return cssRule;
});
@ -216,13 +216,13 @@ export function main() {
describe('modify rules', () => {
it('should allow to change the selector while preserving whitespaces', () => {
expect(processRules('@import a; b {c {d}} e {f}',
(cssRule) => new CssRule(cssRule.selector + '2', cssRule.content)))
(cssRule: any /** TODO #9100 */) => new CssRule(cssRule.selector + '2', cssRule.content)))
.toEqual('@import a2; b2 {c {d}} e2 {f}');
});
it('should allow to change the content', () => {
expect(processRules('a {b}',
(cssRule) => new CssRule(cssRule.selector, cssRule.content + '2')))
(cssRule: any /** TODO #9100 */) => new CssRule(cssRule.selector, cssRule.content + '2')))
.toEqual('a {b2}');
});
});

View File

@ -5,7 +5,7 @@ import {UrlResolver} from '@angular/compiler/src/url_resolver';
export function main() {
describe('extractStyleUrls', () => {
var urlResolver;
var urlResolver: any /** TODO #9100 */;
beforeEach(() => { urlResolver = new UrlResolver(); });

View File

@ -71,7 +71,7 @@ var MOCK_SCHEMA_REGISTRY = [
let zeConsole = console;
export function main() {
var ngIf;
var ngIf: any /** TODO #9100 */;
var parse:
(template: string, directives: CompileDirectiveMetadata[], pipes?: CompilePipeMetadata[]) =>
TemplateAst[];
@ -82,7 +82,7 @@ export function main() {
console = new ArrayConsole();
return [{provide: Console, useValue: console}];
});
beforeEach(inject([TemplateParser], (parser) => {
beforeEach(inject([TemplateParser], (parser: any /** TODO #9100 */) => {
var component = CompileDirectiveMetadata.create({
selector: 'root',
type: new CompileTypeMetadata({moduleUrl: someModuleUrl, name: 'Root'}),
@ -518,10 +518,10 @@ export function main() {
});
describe('providers', () => {
var nextProviderId;
var nextProviderId: any /** TODO #9100 */;
function createToken(value: string): CompileTokenMetadata {
var token;
var token: any /** TODO #9100 */;
if (value.startsWith('type:')) {
token = new CompileTokenMetadata({
identifier:
@ -1071,7 +1071,7 @@ Reference "#a" is defined several times ("<div #a></div><div [ERROR ->]#a></div>
});
describe('content projection', () => {
var compCounter;
var compCounter: any /** TODO #9100 */;
beforeEach(() => { compCounter = 0; });
function createComp(selector: string,

View File

@ -21,7 +21,7 @@ import {
export function main() {
describe('preparseElement', () => {
var htmlParser;
var htmlParser: any /** TODO #9100 */;
beforeEach(inject([HtmlParser], (_htmlParser: HtmlParser) => { htmlParser = _htmlParser; }));
function preparse(html: string): PreparsedElement {

View File

@ -192,7 +192,7 @@ class DirectiveListComp {
export function main() {
describe('test component builder', function() {
it('should instantiate a component with valid DOM',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(ChildComp).then((componentFixture) => {
componentFixture.detectChanges();
@ -203,7 +203,7 @@ export function main() {
}));
it('should allow changing members of the component',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(MyIfComp).then((componentFixture) => {
componentFixture.detectChanges();
@ -218,7 +218,7 @@ export function main() {
}));
it('should override a template',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideTemplate(MockChildComp, '<span>Mock</span>')
.createAsync(MockChildComp)
@ -231,7 +231,7 @@ export function main() {
}));
it('should override a view',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideView(ChildComp,
new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
@ -245,7 +245,7 @@ export function main() {
}));
it('should override component dependencies',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideDirective(ParentComp, ChildComp, MockChildComp)
.createAsync(ParentComp)
@ -258,7 +258,7 @@ export function main() {
}));
it('should override items from a list',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideDirective(DirectiveListComp, ListDir1, ListDir1Alt)
.createAsync(DirectiveListComp)
@ -271,7 +271,7 @@ export function main() {
}));
it("should override child component's dependencies",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
.overrideDirective(ChildWithChildComp, ChildChildComp, MockChildChildComp)
@ -286,7 +286,7 @@ export function main() {
}));
it('should override a provider',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideProviders(TestBindingsComp,
[{provide: FancyService, useClass: MockFancyService}])
@ -301,7 +301,7 @@ export function main() {
it('should override a viewBinding',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.overrideViewProviders(TestViewBindingsComp,
[{provide: FancyService, useClass: MockFancyService}])
@ -318,7 +318,7 @@ export function main() {
describe('ComponentFixture', () => {
it('should auto detect changes if autoDetectChanges is called',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AutoDetectComp)
.then((componentFixture) => {
@ -338,7 +338,7 @@ export function main() {
it('should auto detect changes if ComponentFixtureAutoDetect is provided as true',
withProviders(() => [{provide: ComponentFixtureAutoDetect, useValue: true}])
.inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AutoDetectComp)
.then((componentFixture) => {
@ -354,7 +354,7 @@ export function main() {
it('should signal through whenStable when the fixture is stable (autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AsyncComp).then((componentFixture) => {
componentFixture.autoDetectChanges();
@ -377,7 +377,7 @@ export function main() {
it('should signal through isStable when the fixture is stable (no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AsyncComp).then((componentFixture) => {
componentFixture.detectChanges();
@ -401,7 +401,7 @@ export function main() {
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
'(autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AsyncTimeoutComp)
.then((componentFixture) => {
@ -426,7 +426,7 @@ export function main() {
it('should wait for macroTask(setTimeout) while checking for whenStable ' +
'(no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AsyncTimeoutComp)
.then((componentFixture) => {
@ -452,7 +452,7 @@ export function main() {
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
'(autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(NestedAsyncTimeoutComp)
.then((componentFixture) => {
@ -477,7 +477,7 @@ export function main() {
it('should wait for nested macroTasks(setTimeout) while checking for whenStable ' +
'(no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(NestedAsyncTimeoutComp)
.then((componentFixture) => {
@ -502,7 +502,7 @@ export function main() {
it('should stabilize after async task in change detection (autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AsyncChangeComp)
.then((componentFixture) => {
@ -523,7 +523,7 @@ export function main() {
it('should stabilize after async task in change detection(no autoDetectChanges)',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(AsyncChangeComp)
.then((componentFixture) => {
@ -554,7 +554,7 @@ export function main() {
it('calling autoDetectChanges raises an error', () => {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
async) => {
async: any /** TODO #9100 */) => {
tcb.createAsync(ChildComp).then((componentFixture) => {
expect(() => {
componentFixture.autoDetectChanges();
@ -566,7 +566,7 @@ export function main() {
it('should instantiate a component with valid DOM',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(ChildComp).then((componentFixture) => {
expect(componentFixture.ngZone).toBeNull();
@ -578,7 +578,7 @@ export function main() {
it('should allow changing members of the component',
inject([TestComponentBuilder, AsyncTestCompleter],
(tcb: TestComponentBuilder, async) => {
(tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
tcb.createAsync(MyIfComp).then((componentFixture) => {
componentFixture.detectChanges();
@ -596,7 +596,7 @@ export function main() {
describe('createSync', () => {
it('should create components',
inject([ComponentResolver, TestComponentBuilder, AsyncTestCompleter],
(cr: ComponentResolver, tcb: TestComponentBuilder, async) => {
(cr: ComponentResolver, tcb: TestComponentBuilder, async: any /** TODO #9100 */) => {
cr.resolveComponent(MyIfComp).then((cmpFactory) => {
let componentFixture = tcb.createSync(cmpFactory);

View File

@ -18,7 +18,7 @@ export function main() {
beforeEach(() => { xhr = new MockXHR(); });
function expectResponse(request: Promise<string>, url: string, response: string, done = null) {
function expectResponse(request: Promise<string>, url: string, response: string, done: any /** TODO #9100 */ = null) {
function onResponse(text: string): string {
if (response === null) {
throw `Unexpected response ${url} -> ${text}`;
@ -42,7 +42,7 @@ export function main() {
PromiseWrapper.then(request, onResponse, onError);
}
it('should return a response from the definitions', inject([AsyncTestCompleter], (async) => {
it('should return a response from the definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var url = '/foo';
var response = 'bar';
xhr.when(url, response);
@ -50,15 +50,15 @@ export function main() {
xhr.flush();
}));
it('should return an error from the definitions', inject([AsyncTestCompleter], (async) => {
it('should return an error from the definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var url = '/foo';
var response = null;
var response: any /** TODO #9100 */ = null;
xhr.when(url, response);
expectResponse(xhr.get(url), url, response, () => async.done());
xhr.flush();
}));
it('should return a response from the expectations', inject([AsyncTestCompleter], (async) => {
it('should return a response from the expectations', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var url = '/foo';
var response = 'bar';
xhr.expect(url, response);
@ -66,9 +66,9 @@ export function main() {
xhr.flush();
}));
it('should return an error from the expectations', inject([AsyncTestCompleter], (async) => {
it('should return an error from the expectations', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var url = '/foo';
var response = null;
var response: any /** TODO #9100 */ = null;
xhr.expect(url, response);
expectResponse(xhr.get(url), url, response, () => async.done());
xhr.flush();
@ -83,7 +83,7 @@ export function main() {
expect(() => { xhr.flush(); }).toThrowError('Unexpected request /foo');
});
it('should return expectations before definitions', inject([AsyncTestCompleter], (async) => {
it('should return expectations before definitions', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
var url = '/foo';
xhr.when(url, 'when');
xhr.expect(url, 'expect');