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:
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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(() => {
|
||||
|
Reference in New Issue
Block a user