refactor: add types (#9148)
This commit is contained in:
parent
55860e1621
commit
1f6fd3c8fc
|
@ -276,8 +276,6 @@ class TestComponent {
|
|||
this.nestedBooleanCondition = true;
|
||||
this.numberCondition = 1;
|
||||
this.stringCondition = 'foo';
|
||||
this.functionCondition = function(s: any /** TODO #9100 */, n: any /** TODO #9100 */) {
|
||||
return s == 'foo' && n == 1;
|
||||
};
|
||||
this.functionCondition = function(s: any, n: any): boolean { return s == 'foo' && n == 1; };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export function main() {
|
|||
.toEqual('40px');
|
||||
|
||||
expr = fixture.debugElement.componentInstance.expr;
|
||||
(expr as any /** TODO #9100 */)['max-width'] = '30%';
|
||||
(expr as any)['max-width'] = '30%';
|
||||
fixture.detectChanges();
|
||||
expect(getDOM().getStyle(
|
||||
fixture.debugElement.children[0].nativeElement, 'max-width'))
|
||||
|
@ -153,5 +153,5 @@ export function main() {
|
|||
|
||||
@Component({selector: 'test-cmp', directives: [NgStyle], template: ''})
|
||||
class TestComponent {
|
||||
expr: any /** TODO #9100 */;
|
||||
expr: any;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import {PromiseWrapper} from '../../src/facade/promise';
|
|||
import {SimpleChange} from '@angular/core/src/change_detection';
|
||||
|
||||
class DummyControlValueAccessor implements ControlValueAccessor {
|
||||
writtenValue: any /** TODO #9100 */;
|
||||
writtenValue: any;
|
||||
|
||||
registerOnChange(fn: any /** TODO #9100 */) {}
|
||||
registerOnTouched(fn: any /** TODO #9100 */) {}
|
||||
|
|
|
@ -94,7 +94,7 @@ export class BindingPipe extends AST {
|
|||
}
|
||||
|
||||
export class LiteralPrimitive extends AST {
|
||||
constructor(public value: any /** TODO #9100 */) { super(); }
|
||||
constructor(public value: any) { super(); }
|
||||
visit(visitor: AstVisitor, context: any = null): any {
|
||||
return visitor.visitLiteralPrimitive(this, context);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ export enum TokenType {
|
|||
export class Lexer {
|
||||
tokenize(text: string): any[] {
|
||||
var scanner = new _Scanner(text);
|
||||
var tokens: any[] /** TODO #9100 */ = [];
|
||||
var tokens: Token[] = [];
|
||||
var token = scanner.scanToken();
|
||||
while (token != null) {
|
||||
tokens.push(token);
|
||||
|
@ -162,7 +162,7 @@ export const $RBRACE = /*@ts2dart_const*/ 125;
|
|||
const $NBSP = /*@ts2dart_const*/ 160;
|
||||
|
||||
export class ScannerError extends BaseException {
|
||||
constructor(public message: any /** TODO #9100 */) { super(); }
|
||||
constructor(public message: string) { super(); }
|
||||
|
||||
toString(): string { return this.message; }
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ export class Parser {
|
|||
let split = this.splitInterpolation(input, location);
|
||||
if (split == null) return null;
|
||||
|
||||
let expressions: any[] /** TODO #9100 */ = [];
|
||||
let expressions: AST[] = [];
|
||||
|
||||
for (let i = 0; i < split.expressions.length; ++i) {
|
||||
var tokens = this._lexer.tokenize(this._stripComments(split.expressions[i]));
|
||||
|
@ -101,8 +101,8 @@ export class Parser {
|
|||
if (parts.length <= 1) {
|
||||
return null;
|
||||
}
|
||||
var strings: any[] /** TODO #9100 */ = [];
|
||||
var expressions: any[] /** TODO #9100 */ = [];
|
||||
var strings: string[] = [];
|
||||
var expressions: string[] = [];
|
||||
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var part: string = parts[i];
|
||||
|
@ -130,7 +130,7 @@ export class Parser {
|
|||
}
|
||||
|
||||
private _commentStart(input: string): number {
|
||||
var outerQuote: any /** TODO #9100 */ = null;
|
||||
var outerQuote: number = null;
|
||||
for (var i = 0; i < input.length - 1; i++) {
|
||||
let char = StringWrapper.charCodeAt(input, i);
|
||||
let nextChar = StringWrapper.charCodeAt(input, i + 1);
|
||||
|
@ -238,7 +238,7 @@ export class _ParseAST {
|
|||
}
|
||||
|
||||
parseChain(): AST {
|
||||
var exprs: any[] /** TODO #9100 */ = [];
|
||||
var exprs: AST[] = [];
|
||||
while (this.index < this.tokens.length) {
|
||||
var expr = this.parsePipe();
|
||||
exprs.push(expr);
|
||||
|
@ -267,7 +267,7 @@ export class _ParseAST {
|
|||
|
||||
do {
|
||||
var name = this.expectIdentifierOrKeyword();
|
||||
var args: any[] /** TODO #9100 */ = [];
|
||||
var args: AST[] = [];
|
||||
while (this.optionalCharacter($COLON)) {
|
||||
args.push(this.parseExpression());
|
||||
}
|
||||
|
@ -472,8 +472,8 @@ export class _ParseAST {
|
|||
throw new BaseException('Fell through all cases in parsePrimary');
|
||||
}
|
||||
|
||||
parseExpressionList(terminator: number): any[] {
|
||||
var result: any[] /** TODO #9100 */ = [];
|
||||
parseExpressionList(terminator: number): AST[] {
|
||||
var result: AST[] = [];
|
||||
if (!this.next.isCharacter(terminator)) {
|
||||
do {
|
||||
result.push(this.parsePipe());
|
||||
|
@ -483,8 +483,8 @@ export class _ParseAST {
|
|||
}
|
||||
|
||||
parseLiteralMap(): LiteralMap {
|
||||
var keys: any[] /** TODO #9100 */ = [];
|
||||
var values: any[] /** TODO #9100 */ = [];
|
||||
var keys: string[] = [];
|
||||
var values: AST[] = [];
|
||||
this.expectCharacter($LBRACE);
|
||||
if (!this.optionalCharacter($RBRACE)) {
|
||||
do {
|
||||
|
@ -532,34 +532,13 @@ export class _ParseAST {
|
|||
|
||||
parseCallArguments(): BindingPipe[] {
|
||||
if (this.next.isCharacter($RPAREN)) return [];
|
||||
var positionals: any[] /** TODO #9100 */ = [];
|
||||
var positionals: AST[] = [];
|
||||
do {
|
||||
positionals.push(this.parsePipe());
|
||||
} while (this.optionalCharacter($COMMA));
|
||||
return positionals;
|
||||
return positionals as BindingPipe[];
|
||||
}
|
||||
|
||||
parseBlockContent(): AST {
|
||||
if (!this.parseAction) {
|
||||
this.error('Binding expression cannot contain chained expression');
|
||||
}
|
||||
var exprs: any[] /** TODO #9100 */ = [];
|
||||
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
|
||||
var expr = this.parseExpression();
|
||||
exprs.push(expr);
|
||||
|
||||
if (this.optionalCharacter($SEMICOLON)) {
|
||||
while (this.optionalCharacter($SEMICOLON)) {
|
||||
} // read all semicolons
|
||||
}
|
||||
}
|
||||
if (exprs.length == 0) return new EmptyExpr();
|
||||
if (exprs.length == 1) return exprs[0];
|
||||
|
||||
return new Chain(exprs);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An identifier, a keyword, a string with an optional `-` inbetween.
|
||||
*/
|
||||
|
@ -579,7 +558,7 @@ export class _ParseAST {
|
|||
|
||||
parseTemplateBindings(): TemplateBindingParseResult {
|
||||
var bindings: TemplateBinding[] = [];
|
||||
var prefix: any /** TODO #9100 */ = null;
|
||||
var prefix: string = null;
|
||||
var warnings: string[] = [];
|
||||
while (this.index < this.tokens.length) {
|
||||
var keyIsVar: boolean = this.peekKeywordLet();
|
||||
|
@ -603,8 +582,8 @@ export class _ParseAST {
|
|||
}
|
||||
}
|
||||
this.optionalCharacter($COLON);
|
||||
var name: any /** TODO #9100 */ = null;
|
||||
var expression: any /** TODO #9100 */ = null;
|
||||
var name: string = null;
|
||||
var expression: ASTWithSource = null;
|
||||
if (keyIsVar) {
|
||||
if (this.optionalOperator('=')) {
|
||||
name = this.expectTemplateBindingKey();
|
||||
|
|
|
@ -59,7 +59,7 @@ export interface HtmlAstVisitor {
|
|||
}
|
||||
|
||||
export function htmlVisitAll(visitor: HtmlAstVisitor, asts: HtmlAst[], context: any = null): any[] {
|
||||
var result: any[] /** TODO #9100 */ = [];
|
||||
var result: any[] = [];
|
||||
asts.forEach(ast => {
|
||||
var astResult = ast.visit(visitor, context);
|
||||
if (isPresent(astResult)) {
|
||||
|
|
|
@ -362,7 +362,7 @@ class _HtmlTokenizer {
|
|||
}
|
||||
this._advance();
|
||||
let name = this._input.substring(start.offset + 1, this._index - 1);
|
||||
let char = (NAMED_ENTITIES as any /** TODO #9100 */)[name];
|
||||
let char = (NAMED_ENTITIES as any)[name];
|
||||
if (isBlank(char)) {
|
||||
throw this._createError(unknownEntityErrorMsg(name), this._getSpan(start));
|
||||
}
|
||||
|
@ -372,11 +372,11 @@ class _HtmlTokenizer {
|
|||
|
||||
private _consumeRawText(
|
||||
decodeEntities: boolean, firstCharOfEnd: number, attemptEndRest: Function): HtmlToken {
|
||||
var tagCloseStart: any /** TODO #9100 */;
|
||||
var tagCloseStart: ParseLocation;
|
||||
var textStart = this._getLocation();
|
||||
this._beginToken(
|
||||
decodeEntities ? HtmlTokenType.ESCAPABLE_RAW_TEXT : HtmlTokenType.RAW_TEXT, textStart);
|
||||
var parts: any[] /** TODO #9100 */ = [];
|
||||
var parts: string[] = [];
|
||||
while (true) {
|
||||
tagCloseStart = this._getLocation();
|
||||
if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
|
||||
|
@ -419,11 +419,11 @@ class _HtmlTokenizer {
|
|||
|
||||
private _consumePrefixAndName(): string[] {
|
||||
var nameOrPrefixStart = this._index;
|
||||
var prefix: any /** TODO #9100 */ = null;
|
||||
var prefix: string = null;
|
||||
while (this._peek !== $COLON && !isPrefixEnd(this._peek)) {
|
||||
this._advance();
|
||||
}
|
||||
var nameStart: any /** TODO #9100 */;
|
||||
var nameStart: number;
|
||||
if (this._peek === $COLON) {
|
||||
this._advance();
|
||||
prefix = this._input.substring(nameOrPrefixStart, this._index - 1);
|
||||
|
@ -438,7 +438,7 @@ class _HtmlTokenizer {
|
|||
|
||||
private _consumeTagOpen(start: ParseLocation) {
|
||||
let savedPos = this._savePosition();
|
||||
let lowercaseTagName: any /** TODO #9100 */;
|
||||
let lowercaseTagName: string;
|
||||
try {
|
||||
if (!isAsciiLetter(this._peek)) {
|
||||
throw this._createError(unexpectedCharacterErrorMsg(this._peek), this._getSpan());
|
||||
|
@ -505,11 +505,11 @@ class _HtmlTokenizer {
|
|||
|
||||
private _consumeAttributeValue() {
|
||||
this._beginToken(HtmlTokenType.ATTR_VALUE);
|
||||
var value: any /** TODO #9100 */;
|
||||
var value: string;
|
||||
if (this._peek === $SQ || this._peek === $DQ) {
|
||||
var quoteChar = this._peek;
|
||||
this._advance();
|
||||
var parts: any[] /** TODO #9100 */ = [];
|
||||
var parts: string[] = [];
|
||||
while (this._peek !== quoteChar) {
|
||||
parts.push(this._readChar(true));
|
||||
}
|
||||
|
@ -534,8 +534,7 @@ class _HtmlTokenizer {
|
|||
private _consumeTagClose(start: ParseLocation) {
|
||||
this._beginToken(HtmlTokenType.TAG_CLOSE, start);
|
||||
this._attemptCharCodeUntilFn(isNotWhitespace);
|
||||
var prefixAndName: any /** TODO #9100 */;
|
||||
prefixAndName = this._consumePrefixAndName();
|
||||
let prefixAndName = this._consumePrefixAndName();
|
||||
this._attemptCharCodeUntilFn(isNotWhitespace);
|
||||
this._requireCharCode($GT);
|
||||
this._endToken(prefixAndName);
|
||||
|
@ -596,7 +595,7 @@ class _HtmlTokenizer {
|
|||
var start = this._getLocation();
|
||||
this._beginToken(HtmlTokenType.TEXT, start);
|
||||
|
||||
var parts: any[] /** TODO #9100 */ = [];
|
||||
var parts: string[] = [];
|
||||
let interpolation = false;
|
||||
|
||||
if (this._peek === $LBRACE && this._nextPeek === $LBRACE) {
|
||||
|
@ -719,7 +718,7 @@ function toUpperCaseCharCode(code: number): number {
|
|||
}
|
||||
|
||||
function mergeTextTokens(srcTokens: HtmlToken[]): HtmlToken[] {
|
||||
let dstTokens: any[] /** TODO #9100 */ = [];
|
||||
let dstTokens: HtmlToken[] = [];
|
||||
let lastDstToken: HtmlToken;
|
||||
for (let i = 0; i < srcTokens.length; i++) {
|
||||
let token = srcTokens[i];
|
||||
|
|
|
@ -160,7 +160,7 @@ class TreeBuilder {
|
|||
}
|
||||
|
||||
private _collectExpansionExpTokens(start: HtmlToken): HtmlToken[] {
|
||||
let exp: any[] /** TODO #9100 */ = [];
|
||||
let exp: HtmlToken[] = [];
|
||||
let expansionFormStack = [HtmlTokenType.EXPANSION_CASE_EXP_START];
|
||||
|
||||
while (true) {
|
||||
|
@ -229,7 +229,7 @@ class TreeBuilder {
|
|||
private _consumeStartTag(startTagToken: HtmlToken) {
|
||||
var prefix = startTagToken.parts[0];
|
||||
var name = startTagToken.parts[1];
|
||||
var attrs: any[] /** TODO #9100 */ = [];
|
||||
var attrs: HtmlAttrAst[] = [];
|
||||
while (this.peek.type === HtmlTokenType.ATTR_NAME) {
|
||||
attrs.push(this._consumeAttr(this._advance()));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import {HtmlParseTreeResult, HtmlParser} from '../html_parser';
|
|||
import {ParseError, ParseSourceSpan} from '../parse_util';
|
||||
|
||||
import {expandNodes} from './expander';
|
||||
import {id} from './message';
|
||||
import {Message, id} from './message';
|
||||
import {I18N_ATTR, I18N_ATTR_PREFIX, I18nError, Part, dedupePhName, getPhNameFromBinding, messageFromAttribute, messageFromI18nAttribute, partition} from './shared';
|
||||
|
||||
const _PLACEHOLDER_ELEMENT = 'ph';
|
||||
|
@ -260,14 +260,14 @@ export class I18nHtmlParser implements HtmlParser {
|
|||
}
|
||||
|
||||
private _i18nAttributes(el: HtmlElementAst): HtmlAttrAst[] {
|
||||
let res: any[] /** TODO #9100 */ = [];
|
||||
let res: HtmlAttrAst[] = [];
|
||||
let implicitAttrs: string[] =
|
||||
isPresent(this._implicitAttrs[el.name]) ? this._implicitAttrs[el.name] : [];
|
||||
|
||||
el.attrs.forEach(attr => {
|
||||
if (attr.name.startsWith(I18N_ATTR_PREFIX) || attr.name == I18N_ATTR) return;
|
||||
|
||||
let message: any /** TODO #9100 */;
|
||||
let message: Message;
|
||||
|
||||
let i18ns = el.attrs.filter(a => a.name == `${I18N_ATTR_PREFIX}${attr.name}`);
|
||||
|
||||
|
@ -314,12 +314,11 @@ export class I18nHtmlParser implements HtmlParser {
|
|||
private _replacePlaceholdersWithExpressions(
|
||||
message: string, exps: string[], sourceSpan: ParseSourceSpan): string {
|
||||
let expMap = this._buildExprMap(exps);
|
||||
return RegExpWrapper.replaceAll(
|
||||
_PLACEHOLDER_EXPANDED_REGEXP, message, (match: any /** TODO #9100 */) => {
|
||||
let nameWithQuotes = match[2];
|
||||
let name = nameWithQuotes.substring(1, nameWithQuotes.length - 1);
|
||||
return this._convertIntoExpression(name, expMap, sourceSpan);
|
||||
});
|
||||
return RegExpWrapper.replaceAll(_PLACEHOLDER_EXPANDED_REGEXP, message, (match: string[]) => {
|
||||
let nameWithQuotes = match[2];
|
||||
let name = nameWithQuotes.substring(1, nameWithQuotes.length - 1);
|
||||
return this._convertIntoExpression(name, expMap, sourceSpan);
|
||||
});
|
||||
}
|
||||
|
||||
private _buildExprMap(exps: string[]): Map<string, string> {
|
||||
|
|
|
@ -19,11 +19,11 @@ export class I18nError extends ParseError {
|
|||
|
||||
// Man, this is so ugly!
|
||||
export function partition(nodes: HtmlAst[], errors: ParseError[], implicitTags: string[]): Part[] {
|
||||
let res: any[] /** TODO #9100 */ = [];
|
||||
let res: Part[] = [];
|
||||
|
||||
for (let i = 0; i < nodes.length; ++i) {
|
||||
let n = nodes[i];
|
||||
let temp: any[] /** TODO #9100 */ = [];
|
||||
let temp: HtmlAst[] = [];
|
||||
if (_isOpeningComment(n)) {
|
||||
let i18n = (<HtmlCommentAst>n).value.substring(5).trim();
|
||||
i++;
|
||||
|
|
|
@ -40,7 +40,7 @@ export function deserializeXmb(content: string, url: string): XmbDeserialization
|
|||
}
|
||||
|
||||
let bundleEl = <HtmlElementAst>parsed.rootNodes[0]; // test this
|
||||
let errors: any[] /** TODO #9100 */ = [];
|
||||
let errors: ParseError[] = [];
|
||||
let messages: {[key: string]: HtmlAst[]} = {};
|
||||
|
||||
_createMessages(bundleEl.children, messages, errors);
|
||||
|
@ -90,7 +90,7 @@ function _serializeMessage(m: Message): string {
|
|||
}
|
||||
|
||||
function _expandPlaceholder(input: string): string {
|
||||
return RegExpWrapper.replaceAll(_PLACEHOLDER_REGEXP, input, (match: any /** TODO #9100 */) => {
|
||||
return RegExpWrapper.replaceAll(_PLACEHOLDER_REGEXP, input, (match: string[]) => {
|
||||
let nameWithQuotes = match[2];
|
||||
return `<ph name=${nameWithQuotes}></ph>`;
|
||||
});
|
||||
|
|
|
@ -96,7 +96,7 @@ export class CompileMetadataResolver {
|
|||
var meta = this._directiveCache.get(directiveType);
|
||||
if (isBlank(meta)) {
|
||||
var dirMeta = this._directiveResolver.resolve(directiveType);
|
||||
var templateMeta: any /** TODO #9100 */ = null;
|
||||
var templateMeta: cpl.CompileTemplateMetadata = null;
|
||||
var changeDetectionStrategy: any /** TODO #9100 */ = null;
|
||||
var viewProviders: any[] /** TODO #9100 */ = [];
|
||||
var moduleUrl = staticTypeModuleUrl(directiveType);
|
||||
|
|
|
@ -47,8 +47,8 @@ export class OfflineCompiler {
|
|||
if (components.length === 0) {
|
||||
throw new BaseException('No components given');
|
||||
}
|
||||
var statements: any[] /** TODO #9100 */ = [];
|
||||
var exportedVars: any[] /** TODO #9100 */ = [];
|
||||
var statements: o.DeclareVarStmt[] = [];
|
||||
var exportedVars: string[] = [];
|
||||
var moduleUrl = _templateModuleUrl(components[0].component);
|
||||
components.forEach(componentWithDirs => {
|
||||
var compMeta = <CompileDirectiveMetadata>componentWithDirs.component;
|
||||
|
@ -81,7 +81,7 @@ export class OfflineCompiler {
|
|||
Promise<StyleSheetSourceWithImports> {
|
||||
return this._xhr.get(stylesheetUrl).then((cssText) => {
|
||||
var compileResult = this._styleCompiler.compileStylesheet(stylesheetUrl, cssText, shim);
|
||||
var importedUrls: any[] /** TODO #9100 */ = [];
|
||||
var importedUrls: string[] = [];
|
||||
compileResult.dependencies.forEach((dep) => {
|
||||
importedUrls.push(dep.moduleUrl);
|
||||
dep.valuePlaceholder.moduleUrl = _stylesModuleUrl(dep.moduleUrl, dep.isShimmed, suffix);
|
||||
|
|
|
@ -149,7 +149,7 @@ export class ProviderElementContext {
|
|||
var transformedProviders = resolvedProvider.providers.map((provider) => {
|
||||
var transformedUseValue = provider.useValue;
|
||||
var transformedUseExisting = provider.useExisting;
|
||||
var transformedDeps: any /** TODO #9100 */;
|
||||
var transformedDeps: CompileDiDependencyMetadata[];
|
||||
if (isPresent(provider.useExisting)) {
|
||||
var existingDiDep = this._getDependency(
|
||||
resolvedProvider.providerType,
|
||||
|
|
|
@ -89,7 +89,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
|||
compMeta, compMeta.template.template, normalizedViewDirMetas, pipes,
|
||||
compMeta.type.name);
|
||||
|
||||
var childPromises: any[] /** TODO #9100 */ = [];
|
||||
var childPromises: Promise<any>[] = [];
|
||||
compiledTemplate.init(this._compileComponent(
|
||||
compMeta, parsedTemplate, styles, pipes, compilingComponentsPath,
|
||||
childPromises));
|
||||
|
@ -128,7 +128,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
|||
childPromises.push(this._compiledTemplateDone.get(childCacheKey));
|
||||
}
|
||||
});
|
||||
var factory: any /** TODO #9100 */;
|
||||
var factory: any;
|
||||
if (IS_DART || !this._genConfig.useJit) {
|
||||
factory = interpretStatements(
|
||||
compileResult.statements, compileResult.viewFactoryVar,
|
||||
|
@ -151,7 +151,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
|||
var promises = result.dependencies.map((dep) => this._loadStylesheetDep(dep));
|
||||
return PromiseWrapper.all(promises)
|
||||
.then((cssTexts) => {
|
||||
var nestedCompileResultPromises: any[] /** TODO #9100 */ = [];
|
||||
var nestedCompileResultPromises: Promise<string[]>[] = [];
|
||||
for (var i = 0; i < result.dependencies.length; i++) {
|
||||
var dep = result.dependencies[i];
|
||||
var cssText = cssTexts[i];
|
||||
|
|
|
@ -27,7 +27,7 @@ export class CssSelector {
|
|||
|
||||
static parse(selector: string): CssSelector[] {
|
||||
var results: CssSelector[] = [];
|
||||
var _addResult = (res: CssSelector[], cssSel: any /** TODO #9100 */) => {
|
||||
var _addResult = (res: CssSelector[], cssSel: CssSelector) => {
|
||||
if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) &&
|
||||
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
||||
cssSel.element = '*';
|
||||
|
@ -36,7 +36,7 @@ export class CssSelector {
|
|||
};
|
||||
var cssSelector = new CssSelector();
|
||||
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
||||
var match: any /** TODO #9100 */;
|
||||
var match: string[];
|
||||
var current = cssSelector;
|
||||
var inNot = false;
|
||||
while (isPresent(match = RegExpMatcherWrapper.next(matcher))) {
|
||||
|
@ -153,7 +153,7 @@ export class SelectorMatcher {
|
|||
private _listContexts: SelectorListContext[] = [];
|
||||
|
||||
addSelectables(cssSelectors: CssSelector[], callbackCtxt?: any) {
|
||||
var listContext: any /** TODO #9100 */ = null;
|
||||
var listContext: SelectorListContext = null;
|
||||
if (cssSelectors.length > 1) {
|
||||
listContext = new SelectorListContext(cssSelectors);
|
||||
this._listContexts.push(listContext);
|
||||
|
@ -303,7 +303,7 @@ export class SelectorMatcher {
|
|||
|
||||
/** @internal */
|
||||
_matchTerminal(
|
||||
map: Map<string, SelectorContext[]>, name: any /** TODO #9100 */, cssSelector: CssSelector,
|
||||
map: Map<string, SelectorContext[]>, name: string, cssSelector: CssSelector,
|
||||
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||
if (isBlank(map) || isBlank(name)) {
|
||||
return false;
|
||||
|
@ -317,7 +317,7 @@ export class SelectorMatcher {
|
|||
if (isBlank(selectables)) {
|
||||
return false;
|
||||
}
|
||||
var selectable: any /** TODO #9100 */;
|
||||
var selectable: SelectorContext;
|
||||
var result = false;
|
||||
for (var index = 0; index < selectables.length; index++) {
|
||||
selectable = selectables[index];
|
||||
|
@ -328,8 +328,8 @@ export class SelectorMatcher {
|
|||
|
||||
/** @internal */
|
||||
_matchPartial(
|
||||
map: Map<string, SelectorMatcher>, name: any /** TODO #9100 */, cssSelector: CssSelector,
|
||||
matchedCallback: any /** TODO #9100 */ /*: (c: CssSelector, a: any) => void*/): boolean {
|
||||
map: Map<string, SelectorMatcher>, name: string, cssSelector: CssSelector,
|
||||
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||
if (isBlank(map) || isBlank(name)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export class StyleCompiler {
|
|||
shim: boolean): StylesCompileResult {
|
||||
var styleExpressions =
|
||||
plainStyles.map(plainStyle => o.literal(this._shimIfNeeded(plainStyle, shim)));
|
||||
var dependencies: any[] /** TODO #9100 */ = [];
|
||||
var dependencies: StylesCompileDependency[] = [];
|
||||
for (var i = 0; i < absUrls.length; i++) {
|
||||
var identifier = new CompileIdentifierMetadata({name: getStylesVarName(null)});
|
||||
dependencies.push(new StylesCompileDependency(absUrls[i], shim, identifier));
|
||||
|
|
|
@ -21,17 +21,16 @@ export function isStyleUrlResolvable(url: string): boolean {
|
|||
*/
|
||||
export function extractStyleUrls(
|
||||
resolver: UrlResolver, baseUrl: string, cssText: string): StyleWithImports {
|
||||
var foundUrls: any[] /** TODO #9100 */ = [];
|
||||
var modifiedCssText =
|
||||
StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m: any /** TODO #9100 */) => {
|
||||
var url = isPresent(m[1]) ? m[1] : m[2];
|
||||
if (!isStyleUrlResolvable(url)) {
|
||||
// Do not attempt to resolve non-package absolute URLs with URI scheme
|
||||
return m[0];
|
||||
}
|
||||
foundUrls.push(resolver.resolve(baseUrl, url));
|
||||
return '';
|
||||
});
|
||||
var foundUrls: string[] = [];
|
||||
var modifiedCssText = StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m: string[]) => {
|
||||
var url = isPresent(m[1]) ? m[1] : m[2];
|
||||
if (!isStyleUrlResolvable(url)) {
|
||||
// Do not attempt to resolve non-package absolute URLs with URI scheme
|
||||
return m[0];
|
||||
}
|
||||
foundUrls.push(resolver.resolve(baseUrl, url));
|
||||
return '';
|
||||
});
|
||||
return new StyleWithImports(modifiedCssText, foundUrls);
|
||||
}
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ export interface TemplateAstVisitor {
|
|||
*/
|
||||
export function templateVisitAll(
|
||||
visitor: TemplateAstVisitor, asts: TemplateAst[], context: any = null): any[] {
|
||||
var result: any[] /** TODO #9100 */ = [];
|
||||
var result: any[] = [];
|
||||
asts.forEach(ast => {
|
||||
var astResult = ast.visit(visitor, context);
|
||||
if (isPresent(astResult)) {
|
||||
|
|
|
@ -15,9 +15,9 @@ const NG_NON_BINDABLE_ATTR = 'ngNonBindable';
|
|||
const NG_PROJECT_AS = 'ngProjectAs';
|
||||
|
||||
export function preparseElement(ast: HtmlElementAst): PreparsedElement {
|
||||
var selectAttr: any /** TODO #9100 */ = null;
|
||||
var hrefAttr: any /** TODO #9100 */ = null;
|
||||
var relAttr: any /** TODO #9100 */ = null;
|
||||
var selectAttr: string = null;
|
||||
var hrefAttr: string = null;
|
||||
var relAttr: string = null;
|
||||
var nonBindable = false;
|
||||
var projectAs: string = null;
|
||||
ast.attrs.forEach(attr => {
|
||||
|
|
|
@ -101,7 +101,7 @@ export function getUrlScheme(url: string): string {
|
|||
function _buildFromEncodedParts(
|
||||
opt_scheme?: string, opt_userInfo?: string, opt_domain?: string, opt_port?: string,
|
||||
opt_path?: string, opt_queryData?: string, opt_fragment?: string): string {
|
||||
var out: any[] /** TODO #9100 */ = [];
|
||||
var out: string[] = [];
|
||||
|
||||
if (isPresent(opt_scheme)) {
|
||||
out.push(opt_scheme + ':');
|
||||
|
|
|
@ -8,12 +8,12 @@ var DASH_CASE_REGEXP = /-([a-z])/g;
|
|||
|
||||
export function camelCaseToDashCase(input: string): string {
|
||||
return StringWrapper.replaceAllMapped(
|
||||
input, CAMEL_CASE_REGEXP, (m: any /** TODO #9100 */) => { return '-' + m[1].toLowerCase(); });
|
||||
input, CAMEL_CASE_REGEXP, (m: string[]) => { return '-' + m[1].toLowerCase(); });
|
||||
}
|
||||
|
||||
export function dashCaseToCamelCase(input: string): string {
|
||||
return StringWrapper.replaceAllMapped(
|
||||
input, DASH_CASE_REGEXP, (m: any /** TODO #9100 */) => { return m[1].toUpperCase(); });
|
||||
input, DASH_CASE_REGEXP, (m: string[]) => { return m[1].toUpperCase(); });
|
||||
}
|
||||
|
||||
export function splitAtColon(input: string, defaultValues: string[]): string[] {
|
||||
|
|
|
@ -157,13 +157,13 @@ export function isArray(obj: any): boolean {
|
|||
return Array.isArray(obj);
|
||||
}
|
||||
|
||||
export function isDate(obj: any /** TODO #9100 */): boolean {
|
||||
export function isDate(obj: any): obj is Date {
|
||||
return obj instanceof Date && !isNaN(obj.valueOf());
|
||||
}
|
||||
|
||||
export function noop() {}
|
||||
|
||||
export function stringify(token: any /** TODO #9100 */): string {
|
||||
export function stringify(token: any): string {
|
||||
if (typeof token === 'string') {
|
||||
return token;
|
||||
}
|
||||
|
@ -187,16 +187,15 @@ export function stringify(token: any /** TODO #9100 */): string {
|
|||
// serialize / deserialize enum exist only for consistency with dart API
|
||||
// enums in typescript don't need to be serialized
|
||||
|
||||
export function serializeEnum(val: any /** TODO #9100 */): number {
|
||||
export function serializeEnum(val: any): number {
|
||||
return val;
|
||||
}
|
||||
|
||||
export function deserializeEnum(val: any /** TODO #9100 */, values: Map<number, any>): any {
|
||||
export function deserializeEnum(val: any, values: Map<number, any>): any {
|
||||
return val;
|
||||
}
|
||||
|
||||
export function resolveEnumToken(
|
||||
enumValue: any /** TODO #9100 */, val: any /** TODO #9100 */): string {
|
||||
export function resolveEnumToken(enumValue: any, val: any): string {
|
||||
return enumValue[val];
|
||||
}
|
||||
|
||||
|
@ -246,7 +245,7 @@ export class StringWrapper {
|
|||
}
|
||||
|
||||
static replaceAllMapped(s: string, from: RegExp, cb: Function): string {
|
||||
return s.replace(from, function(...matches: any[] /** TODO #9100 */) {
|
||||
return s.replace(from, function(...matches: any[]) {
|
||||
// Remove offset & string from the result array
|
||||
matches.splice(-2, 2);
|
||||
// The callback receives match, p1, ..., pn
|
||||
|
@ -268,7 +267,7 @@ export class StringWrapper {
|
|||
}
|
||||
|
||||
export class StringJoiner {
|
||||
constructor(public parts: any[] /** TODO #9100 */ = []) {}
|
||||
constructor(public parts: string[] = []) {}
|
||||
|
||||
add(part: string): void { this.parts.push(part); }
|
||||
|
||||
|
@ -379,7 +378,7 @@ export class FunctionWrapper {
|
|||
}
|
||||
|
||||
// JS has NaN !== NaN
|
||||
export function looseIdentical(a: any /** TODO #9100 */, b: any /** TODO #9100 */): boolean {
|
||||
export function looseIdentical(a: any, b: any): boolean {
|
||||
return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
|
||||
}
|
||||
|
||||
|
@ -449,8 +448,8 @@ export function setValueOnPath(global: any, path: string, value: any) {
|
|||
}
|
||||
|
||||
// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
|
||||
declare var Symbol: any /** TODO #9100 */;
|
||||
var _symbolIterator: any /** TODO #9100 */ = null;
|
||||
declare var Symbol: any;
|
||||
var _symbolIterator: any = null;
|
||||
export function getSymbolIterator(): string|symbol {
|
||||
if (isBlank(_symbolIterator)) {
|
||||
if (isPresent((<any>globalScope).Symbol) && isPresent(Symbol.iterator)) {
|
||||
|
@ -461,7 +460,7 @@ export function getSymbolIterator(): string|symbol {
|
|||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
if (key !== 'entries' && key !== 'size' &&
|
||||
(Map as any /** TODO #9100 */).prototype[key] === Map.prototype['entries']) {
|
||||
(Map as any).prototype[key] === Map.prototype['entries']) {
|
||||
_symbolIterator = key;
|
||||
}
|
||||
}
|
||||
|
@ -473,8 +472,8 @@ export function getSymbolIterator(): string|symbol {
|
|||
export function evalExpression(
|
||||
sourceUrl: string, expr: string, declarations: string, vars: {[key: string]: any}): any {
|
||||
var fnBody = `${declarations}\nreturn ${expr}\n//# sourceURL=${sourceUrl}`;
|
||||
var fnArgNames: any[] /** TODO #9100 */ = [];
|
||||
var fnArgValues: any[] /** TODO #9100 */ = [];
|
||||
var fnArgNames: string[] = [];
|
||||
var fnArgValues: any[] = [];
|
||||
for (var argName in vars) {
|
||||
fnArgNames.push(argName);
|
||||
fnArgValues.push(vars[argName]);
|
||||
|
|
|
@ -15,7 +15,7 @@ export class PromiseCompleter<R> {
|
|||
export class PromiseWrapper {
|
||||
static resolve<T>(obj: T): Promise<T> { return Promise.resolve(obj); }
|
||||
|
||||
static reject(obj: any, _: any /** TODO #9100 */): Promise<any> { return Promise.reject(obj); }
|
||||
static reject(obj: any, _: any): Promise<any> { return Promise.reject(obj); }
|
||||
|
||||
// Note: We can't rename this method into `catch`, as this is not a valid
|
||||
// method name in Dart.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// This file intentionally left blank. It is used to load nothing in some cases.
|
||||
// Such as parse5/index is redirected here instead of loading into browser.
|
||||
|
||||
export var __empty__: any /** TODO #9100 */;
|
||||
export var __empty__: any;
|
||||
|
|
Loading…
Reference in New Issue