From aab0c57aeea8edf10a70367660cc28a208fe051a Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Fri, 9 Oct 2015 09:28:12 -0700 Subject: [PATCH] fix(typings): add more missing typings. This is the same bug pattern I reported in https://github.com/Microsoft/TypeScript/issues/5187 Closes #4636 --- modules/angular2/src/core/compiler/selector.ts | 8 ++++---- .../src/core/render/dom/events/key_events.ts | 14 +++++++------- modules/angular2/src/core/zone/ng_zone.ts | 2 +- npm-shrinkwrap.clean.json | 2 +- npm-shrinkwrap.json | 6 +++--- package.json | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/angular2/src/core/compiler/selector.ts b/modules/angular2/src/core/compiler/selector.ts index e07ad94b79..bfd898f8da 100644 --- a/modules/angular2/src/core/compiler/selector.ts +++ b/modules/angular2/src/core/compiler/selector.ts @@ -260,7 +260,7 @@ export class SelectorMatcher { * @param matchedCallback This callback will be called with the object handed into `addSelectable` * @return boolean true if a match was found */ - match(cssSelector: CssSelector, matchedCallback: (CssSelector, any) => void): boolean { + match(cssSelector: CssSelector, matchedCallback: (c: CssSelector, a: any) => void): boolean { var result = false; var element = cssSelector.element; var classNames = cssSelector.classNames; @@ -313,7 +313,7 @@ export class SelectorMatcher { } _matchTerminal(map: Map, name, cssSelector: CssSelector, - matchedCallback: (CssSelector, any) => void): boolean { + matchedCallback: (c: CssSelector, a: any) => void): boolean { if (isBlank(map) || isBlank(name)) { return false; } @@ -336,7 +336,7 @@ export class SelectorMatcher { } _matchPartial(map: Map, name, cssSelector: CssSelector, - matchedCallback /*: (CssSelector, any) => void*/): boolean { + matchedCallback /*: (c: CssSelector, a: any) => void*/): boolean { if (isBlank(map) || isBlank(name)) { return false; } @@ -367,7 +367,7 @@ export class SelectorContext { this.notSelectors = selector.notSelectors; } - finalize(cssSelector: CssSelector, callback: (CssSelector, any) => void): boolean { + finalize(cssSelector: CssSelector, callback: (c: CssSelector, a: any) => void): boolean { var result = true; if (this.notSelectors.length > 0 && (isBlank(this.listContext) || !this.listContext.alreadyMatched)) { diff --git a/modules/angular2/src/core/render/dom/events/key_events.ts b/modules/angular2/src/core/render/dom/events/key_events.ts index 56656d25fd..b5248191c2 100644 --- a/modules/angular2/src/core/render/dom/events/key_events.ts +++ b/modules/angular2/src/core/render/dom/events/key_events.ts @@ -12,11 +12,11 @@ import {NgZone} from 'angular2/src/core/zone/ng_zone'; import {Injectable} from 'angular2/src/core/di'; var modifierKeys = ['alt', 'control', 'meta', 'shift']; -var modifierKeyGetters: {[key: string]: Function} = { - 'alt': (event) => event.altKey, - 'control': (event) => event.ctrlKey, - 'meta': (event) => event.metaKey, - 'shift': (event) => event.shiftKey +var modifierKeyGetters: {[key: string]: (event: KeyboardEvent) => boolean} = { + 'alt': (event: KeyboardEvent) => event.altKey, + 'control': (event: KeyboardEvent) => event.ctrlKey, + 'meta': (event: KeyboardEvent) => event.metaKey, + 'shift': (event: KeyboardEvent) => event.shiftKey }; @Injectable() @@ -69,7 +69,7 @@ export class KeyEventsPlugin extends EventManagerPlugin { return result; } - static getEventFullKey(event: Event): string { + static getEventFullKey(event: KeyboardEvent): string { var fullKey = ''; var key = DOM.getEventKey(event); key = key.toLowerCase(); @@ -91,7 +91,7 @@ export class KeyEventsPlugin extends EventManagerPlugin { } static eventCallback(element: HTMLElement, fullKey: any, handler: (Event) => any, zone: NgZone): - (event: Event) => void { + (event: KeyboardEvent) => void { return (event) => { if (StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { zone.run(() => handler(event)); diff --git a/modules/angular2/src/core/zone/ng_zone.ts b/modules/angular2/src/core/zone/ng_zone.ts index debdf91216..1ffc4c88c6 100644 --- a/modules/angular2/src/core/zone/ng_zone.ts +++ b/modules/angular2/src/core/zone/ng_zone.ts @@ -90,7 +90,7 @@ export class NgZone { _onTurnStart: () => void; _onTurnDone: () => void; _onEventDone: () => void; - _onErrorHandler: (error, stack) => void; + _onErrorHandler: (error: any, stack: any) => void; // Number of microtasks pending from _innerZone (& descendants) _pendingMicrotasks: number; diff --git a/npm-shrinkwrap.clean.json b/npm-shrinkwrap.clean.json index 5ccbbb55dc..043f4d9ebf 100644 --- a/npm-shrinkwrap.clean.json +++ b/npm-shrinkwrap.clean.json @@ -10956,7 +10956,7 @@ } }, "ts2dart": { - "version": "0.7.11", + "version": "0.7.12", "dependencies": { "source-map": { "version": "0.4.4", diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 721bb7aa70..8b761b8248 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -16912,9 +16912,9 @@ } }, "ts2dart": { - "version": "0.7.11", - "from": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.11.tgz", - "resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.11.tgz", + "version": "0.7.12", + "from": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.12.tgz", + "resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.12.tgz", "dependencies": { "source-map": { "version": "0.4.4", diff --git a/package.json b/package.json index 7da5418b58..73f3c75400 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "temp": "^0.8.1", "ternary-stream": "^1.2.3", "through2": "^0.6.1", - "ts2dart": "^0.7.11", + "ts2dart": "^0.7.12", "tsd": "^0.6.5-beta", "tslint": "^2.5.0", "typescript": "^1.6.2",