fix(build): add missing return types now enforced by linter

This commit is contained in:
Alex Eagle
2015-06-26 11:10:52 -07:00
parent bc585f2724
commit 44891996b5
61 changed files with 467 additions and 400 deletions

View File

@ -217,7 +217,7 @@ export class DirectiveMetadata {
callOnAllChangesDone?: boolean,
changeDetection?: string,
exportAs?: string
}) {
}): DirectiveMetadata {
let hostListeners = new Map();
let hostProperties = new Map();
let hostAttributes = new Map();

View File

@ -11,13 +11,14 @@ export class CompileControl {
_currentStepIndex: number = 0;
_parent: CompileElement = null;
_results: any[] = null;
_additionalChildren: any[] = null;
_additionalChildren: CompileElement[] = null;
_ignoreCurrentElement: boolean;
constructor(public _steps: List<CompileStep>) {}
// only public so that it can be used by compile_pipeline
internalProcess(results: any[], startStepIndex, parent: CompileElement, current: CompileElement) {
internalProcess(results: any[], startStepIndex, parent: CompileElement,
current: CompileElement): CompileElement[] {
this._results = results;
var previousStepIndex = this._currentStepIndex;
var previousParent = this._parent;

View File

@ -33,11 +33,11 @@ export class CompileElement {
}
}
isBound() {
isBound(): boolean {
return isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0;
}
bindElement() {
bindElement(): ElementBinderBuilder {
if (!this.isBound()) {
var parentBinder = this.inheritedElementBinder;
this.inheritedElementBinder =

View File

@ -135,7 +135,7 @@ export class CssSelector {
* are contained in a given CssSelector.
*/
export class SelectorMatcher {
static createNotMatcher(notSelectors: List<CssSelector>) {
static createNotMatcher(notSelectors: List<CssSelector>): SelectorMatcher {
var notMatcher = new SelectorMatcher();
notMatcher.addSelectables(notSelectors, null);
return notMatcher;
@ -353,7 +353,7 @@ class SelectorContext {
this.notSelectors = selector.notSelectors;
}
finalize(cssSelector: CssSelector, callback /*: (CssSelector, any) => void*/) {
finalize(cssSelector: CssSelector, callback /*: (CssSelector, any) => void*/): boolean {
var result = true;
if (this.notSelectors.length > 0 &&
(isBlank(this.listContext) || !this.listContext.alreadyMatched)) {

View File

@ -12,7 +12,7 @@ import {UrlResolver} from 'angular2/src/services/url_resolver';
export class StyleUrlResolver {
constructor(public _resolver: UrlResolver) {}
resolveUrls(cssText: string, baseUrl: string) {
resolveUrls(cssText: string, baseUrl: string): string {
cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl);
cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl);
return cssText;

View File

@ -53,7 +53,7 @@ export class DomRenderer extends Renderer {
// noop for now
}
getNativeElementSync(location: RenderElementRef) {
getNativeElementSync(location: RenderElementRef): any {
return resolveInternalDomView(location.renderView)
.boundElements[location.boundElementIndex]
.element;

View File

@ -90,7 +90,7 @@ export class DomEventsPlugin extends EventManagerPlugin {
DomEventsPlugin.sameElementCallback(element, handler, zone);
}
static sameElementCallback(element, handler, zone) {
static sameElementCallback(element, handler, zone): (event: Event) => void {
return (event) => {
if (event.target === element) {
zone.run(() => handler(event));
@ -98,7 +98,7 @@ export class DomEventsPlugin extends EventManagerPlugin {
};
}
static bubbleCallback(element, handler, zone) {
static bubbleCallback(element, handler, zone): (event: Event) => void {
return (event) => zone.run(() => handler(event));
}
}

View File

@ -11,13 +11,12 @@ import {StringMapWrapper, ListWrapper} from 'angular2/src/facade/collection';
import {EventManagerPlugin} from './event_manager';
var modifierKeys = ['alt', 'control', 'meta', 'shift'];
var modifierKeyGetters: StringMap<string, Function> =
{
'alt': (event) => event.altKey,
'control': (event) => event.ctrlKey,
'meta': (event) => event.metaKey,
'shift': (event) => event.shiftKey
}
var modifierKeyGetters: StringMap<string, Function> = {
'alt': (event) => event.altKey,
'control': (event) => event.ctrlKey,
'meta': (event) => event.metaKey,
'shift': (event) => event.shiftKey
};
export class KeyEventsPlugin extends EventManagerPlugin {
constructor() { super(); }
@ -38,7 +37,7 @@ export class KeyEventsPlugin extends EventManagerPlugin {
});
}
static parseEventName(eventName: string) /* {'domEventName': string, 'fullKey': string} */ {
static parseEventName(eventName: string): StringMap<string, string> {
var parts = eventName.toLowerCase().split('.');
var domEventName = ListWrapper.removeAt(parts, 0);
@ -63,8 +62,10 @@ export class KeyEventsPlugin extends EventManagerPlugin {
// returning null instead of throwing to let another plugin process the event
return null;
}
return {'domEventName': domEventName, 'fullKey': fullKey};
var result = StringMapWrapper.create();
StringMapWrapper.set(result, 'domEventName', domEventName);
StringMapWrapper.set(result, 'fullKey', fullKey);
return result;
}
static getEventFullKey(event): string {
@ -88,7 +89,8 @@ export class KeyEventsPlugin extends EventManagerPlugin {
return fullKey;
}
static eventCallback(element, shouldSupportBubble, fullKey, handler, zone) {
static eventCallback(element, shouldSupportBubble, fullKey, handler,
zone): (event: Event) => void {
return (event) => {
var correctElement = shouldSupportBubble || event.target === element;
if (correctElement && StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {

View File

@ -20,7 +20,7 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
hasNativeContentElement(): boolean { return false; }
prepareShadowRoot(el) { return el; }
prepareShadowRoot(el): /*(#2770) Node*/ any { return el; }
constructLightDom(lightDomView: viewModule.DomView, el): LightDom {
return new LightDom(lightDomView, el);

View File

@ -10,5 +10,5 @@ import {ShadowDomStrategy} from './shadow_dom_strategy';
*/
@Injectable()
export class NativeShadowDomStrategy extends ShadowDomStrategy {
prepareShadowRoot(el) { return DOM.createShadowRoot(el); }
prepareShadowRoot(el): /*(#2770) Node*/ any { return DOM.createShadowRoot(el); }
}

View File

@ -10,7 +10,7 @@ var _nextComponentUID: int = 0;
var _sharedStyleTexts: Map<string, boolean> = new Map();
var _lastInsertedStyleEl;
export function getComponentId(componentStringId: string) {
export function getComponentId(componentStringId: string): number {
var id = _componentUIDs.get(componentStringId);
if (isBlank(id)) {
id = _nextComponentUID++;
@ -43,12 +43,12 @@ export function insertStyleElement(host, styleEl) {
}
// Return the attribute to be added to the component
export function getHostAttribute(id: int) {
export function getHostAttribute(id: int): string {
return `_nghost-${id}`;
}
// Returns the attribute to be added on every single element nodes in the component
export function getContentAttribute(id: int) {
export function getContentAttribute(id: int): string {
return `_ngcontent-${id}`;
}

View File

@ -8,12 +8,12 @@ export const EVENT_TARGET_SEPARATOR = ':';
var CAMEL_CASE_REGEXP = RegExpWrapper.create('([A-Z])');
var DASH_CASE_REGEXP = RegExpWrapper.create('-([a-z])');
export function camelCaseToDashCase(input: string) {
export function camelCaseToDashCase(input: string): string {
return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP,
(m) => { return '-' + m[1].toLowerCase(); });
}
export function dashCaseToCamelCase(input: string) {
export function dashCaseToCamelCase(input: string): string {
return StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP,
(m) => { return m[1].toUpperCase(); });
}

View File

@ -293,7 +293,7 @@ export class EventBuilder extends AstTransformer {
return result;
}
visitAccessMember(ast: AccessMember) {
visitAccessMember(ast: AccessMember): AccessMember {
var isEventAccess = false;
var current: AST = ast;
while (!isEventAccess && (current instanceof AccessMember)) {
@ -313,11 +313,11 @@ export class EventBuilder extends AstTransformer {
}
}
buildEventLocals() { return this.locals; }
buildEventLocals(): List<AST> { return this.locals; }
buildLocalEvents() { return this.localEvents; }
buildLocalEvents(): List<Event> { return this.localEvents; }
buildGlobalEvents() { return this.globalEvents; }
buildGlobalEvents(): List<Event> { return this.globalEvents; }
merge(eventBuilder: EventBuilder) {
this._merge(this.localEvents, eventBuilder.localEvents);
@ -343,9 +343,10 @@ const ATTRIBUTE_PREFIX = 'attr';
const CLASS_PREFIX = 'class';
const STYLE_PREFIX = 'style';
function buildElementPropertyBindings(protoElement: /*element*/ any, isNgComponent: boolean,
bindingsInTemplate: Map<string, ASTWithSource>,
directiveTempaltePropertyNames: Set<string>) {
function buildElementPropertyBindings(
protoElement: /*element*/ any, isNgComponent: boolean,
bindingsInTemplate: Map<string, ASTWithSource>,
directiveTempaltePropertyNames: Set<string>): List<api.ElementPropertyBinding> {
var propertyBindings = [];
MapWrapper.forEach(bindingsInTemplate, (ast, propertyNameInTemplate) => {
var propertyBinding = createElementPropertyBinding(ast, propertyNameInTemplate);

View File

@ -9,7 +9,7 @@ import {DomElement} from './element';
import {RenderViewRef, EventDispatcher} from '../../api';
import {camelCaseToDashCase} from '../util';
export function resolveInternalDomView(viewRef: RenderViewRef) {
export function resolveInternalDomView(viewRef: RenderViewRef): DomView {
return (<DomViewRef>viewRef)._view;
}

View File

@ -6,7 +6,7 @@ export class DomViewContainer {
// The order in this list matches the DOM order.
views: List<viewModule.DomView> = [];
contentTagContainers() { return this.views; }
contentTagContainers(): List<viewModule.DomView> { return this.views; }
nodes(): List</*node*/ any> {
var r = [];