From a121136fae630aa08d53eb550369cf982f884725 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Fri, 30 Sep 2016 13:06:14 -0700 Subject: [PATCH] refactor(ShadowCss): add missing types --- modules/@angular/compiler/src/shadow_css.ts | 2 +- modules/@angular/compiler/test/shadow_css_spec.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/@angular/compiler/src/shadow_css.ts b/modules/@angular/compiler/src/shadow_css.ts index e15f58b105..0abf47876a 100644 --- a/modules/@angular/compiler/src/shadow_css.ts +++ b/modules/@angular/compiler/src/shadow_css.ts @@ -509,7 +509,7 @@ export class CssRule { constructor(public selector: string, public content: string) {} } -export function processRules(input: string, ruleCallback: Function): string { +export function processRules(input: string, ruleCallback: (rule: CssRule) => CssRule): string { const inputWithEscapedBlocks = escapeBlocks(input); let nextBlockIndex = 0; return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function(...m: string[]) { diff --git a/modules/@angular/compiler/test/shadow_css_spec.ts b/modules/@angular/compiler/test/shadow_css_spec.ts index 3750f8b004..63b1e8845a 100644 --- a/modules/@angular/compiler/test/shadow_css_spec.ts +++ b/modules/@angular/compiler/test/shadow_css_spec.ts @@ -207,8 +207,8 @@ export function main() { describe('processRules', () => { describe('parse rules', () => { function captureRules(input: string): CssRule[] { - const result: any[] /** TODO #9100 */ = []; - processRules(input, (cssRule: any /** TODO #9100 */) => { + const result: CssRule[] = []; + processRules(input, (cssRule) => { result.push(cssRule); return cssRule; }); @@ -239,15 +239,15 @@ 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: any /** TODO #9100 */) => new CssRule( - cssRule.selector + '2', cssRule.content))) + '@import a; b {c {d}} e {f}', + (cssRule: CssRule) => 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: any /** TODO #9100 */) => - new CssRule(cssRule.selector, cssRule.content + '2'))) + 'a {b}', + (cssRule: CssRule) => new CssRule(cssRule.selector, cssRule.content + '2'))) .toEqual('a {b2}'); }); });