chore(tslint): fix noImplicitAny errors

This commit is contained in:
Adam Bradley
2016-05-31 18:40:29 -05:00
parent f14e2dc04b
commit 03f4511635
21 changed files with 92 additions and 93 deletions

View File

@ -360,7 +360,7 @@ export class Animation {
_asyncEnd(duration: number, shouldComplete: boolean) { _asyncEnd(duration: number, shouldComplete: boolean) {
var self = this; var self = this;
function onTransitionEnd(ev) { function onTransitionEnd(ev: any) {
console.debug('Animation onTransitionEnd', ev.target.nodeName, ev.propertyName); console.debug('Animation onTransitionEnd', ev.target.nodeName, ev.propertyName);
// ensure transition end events and timeouts have been cleared // ensure transition end events and timeouts have been cleared
@ -817,7 +817,7 @@ interface EffectState {
unit: string; unit: string;
} }
const TRANSFORMS = { const TRANSFORMS: any = {
'translateX': 1, 'translateY': 1, 'translateZ': 1, 'translateX': 1, 'translateY': 1, 'translateZ': 1,
'scale': 1, 'scaleX': 1, 'scaleY': 1, 'scaleZ': 1, 'scale': 1, 'scaleX': 1, 'scaleY': 1, 'scaleZ': 1,
'rotate': 1, 'rotateX': 1, 'rotateY': 1, 'rotateZ': 1, 'rotate': 1, 'rotateX': 1, 'rotateY': 1, 'rotateZ': 1,

View File

@ -3,7 +3,7 @@ import {Animation} from './animation';
class SlideIn extends Animation { class SlideIn extends Animation {
constructor(element) { constructor(element: any) {
super(element); super(element);
this this
.easing('cubic-bezier(0.1,0.7,0.1,1)') .easing('cubic-bezier(0.1,0.7,0.1,1)')
@ -15,7 +15,7 @@ Animation.register('slide-in', SlideIn);
class SlideOut extends Animation { class SlideOut extends Animation {
constructor(element) { constructor(element: any) {
super(element); super(element);
this this
.easing('ease-out') .easing('ease-out')
@ -27,7 +27,7 @@ Animation.register('slide-out', SlideOut);
class FadeIn extends Animation { class FadeIn extends Animation {
constructor(element) { constructor(element: any) {
super(element); super(element);
this this
.easing('ease-in') .easing('ease-in')
@ -39,7 +39,7 @@ Animation.register('fade-in', FadeIn);
class FadeOut extends Animation { class FadeOut extends Animation {
constructor(element) { constructor(element: any) {
super(element); super(element);
this this
.easing('ease-out') .easing('ease-out')

View File

@ -273,9 +273,9 @@ class ActionSheetCmp {
onPageLoaded() { onPageLoaded() {
// normalize the data // normalize the data
let buttons = []; let buttons: any[] = [];
this.d.buttons.forEach(button => { this.d.buttons.forEach((button: any) => {
if (typeof button === 'string') { if (typeof button === 'string') {
button = { text: button }; button = { text: button };
} }
@ -327,7 +327,7 @@ class ActionSheetCmp {
} }
} }
click(button, dismissDelay?) { click(button: any, dismissDelay?: number) {
if (!this.isEnabled()) { if (!this.isEnabled()) {
return; return;
} }
@ -360,7 +360,7 @@ class ActionSheetCmp {
} }
} }
dismiss(role): Promise<any> { dismiss(role: any): Promise<any> {
return this._viewCtrl.dismiss(null, role); return this._viewCtrl.dismiss(null, role);
} }
@ -380,7 +380,7 @@ export interface ActionSheetOptions {
class ActionSheetSlideIn extends Transition { class ActionSheetSlideIn extends Transition {
constructor(enteringView, leavingView, opts: TransitionOptions) { constructor(enteringView: ViewController, leavingView: ViewController, opts: TransitionOptions) {
super(opts); super(opts);
let ele = enteringView.pageRef().nativeElement; let ele = enteringView.pageRef().nativeElement;

View File

@ -423,12 +423,6 @@ class AlertCmp {
// normalize the data // normalize the data
let data = this.d; let data = this.d;
if (data['body']) {
// deprecated warning
console.warn('Alert `body` property has been renamed to `message`');
data.message = data['body'];
}
data.buttons = data.buttons.map(button => { data.buttons = data.buttons.map(button => {
if (typeof button === 'string') { if (typeof button === 'string') {
return { text: button }; return { text: button };
@ -451,7 +445,7 @@ class AlertCmp {
// An alert can be created with several different inputs. Radios, // An alert can be created with several different inputs. Radios,
// checkboxes and inputs are all accepted, but they cannot be mixed. // checkboxes and inputs are all accepted, but they cannot be mixed.
let inputTypes = []; let inputTypes: any[] = [];
data.inputs.forEach(input => { data.inputs.forEach(input => {
if (inputTypes.indexOf(input.type) < 0) { if (inputTypes.indexOf(input.type) < 0) {
inputTypes.push(input.type); inputTypes.push(input.type);
@ -503,7 +497,7 @@ class AlertCmp {
} }
} }
btnClick(button, dismissDelay?) { btnClick(button: any, dismissDelay?: number) {
if (!this.isEnabled()) { if (!this.isEnabled()) {
return; return;
} }
@ -529,7 +523,7 @@ class AlertCmp {
} }
} }
rbClick(checkedInput) { rbClick(checkedInput: any) {
if (this.isEnabled()) { if (this.isEnabled()) {
this.d.inputs.forEach(input => { this.d.inputs.forEach(input => {
input.checked = (checkedInput === input); input.checked = (checkedInput === input);
@ -538,7 +532,7 @@ class AlertCmp {
} }
} }
cbClick(checkedInput) { cbClick(checkedInput: any) {
if (this.isEnabled()) { if (this.isEnabled()) {
checkedInput.checked = !checkedInput.checked; checkedInput.checked = !checkedInput.checked;
} }
@ -556,7 +550,7 @@ class AlertCmp {
} }
} }
dismiss(role): Promise<any> { dismiss(role: any): Promise<any> {
return this._viewCtrl.dismiss(this.getValues(), role); return this._viewCtrl.dismiss(this.getValues(), role);
} }

View File

@ -101,7 +101,7 @@ export class App {
*/ */
getActiveNav(): any { getActiveNav(): any {
var nav = this._rootNav || null; var nav = this._rootNav || null;
var activeChildNav; var activeChildNav: any;
while (nav) { while (nav) {
activeChildNav = nav.getActiveChildNav(); activeChildNav = nav.getActiveChildNav();

View File

@ -31,7 +31,8 @@ export class Badge {
*/ */
private _readAttrs(element: HTMLElement) { private _readAttrs(element: HTMLElement) {
let elementAttrs = element.attributes; let elementAttrs = element.attributes;
let attrName; let attrName: string;
for (let i = 0, l = elementAttrs.length; i < l; i++) { for (let i = 0, l = elementAttrs.length; i < l; i++) {
if (elementAttrs[i].value !== '') continue; if (elementAttrs[i].value !== '') continue;

View File

@ -233,8 +233,8 @@ export class Button {
if (childNodes.length > 0) { if (childNodes.length > 0) {
childNodes = childNodes[0].childNodes; childNodes = childNodes[0].childNodes;
} }
let childNode; let childNode: Node;
let nodes = []; let nodes: number[] = [];
for (let i = 0, l = childNodes.length; i < l; i++) { for (let i = 0, l = childNodes.length; i < l; i++) {
childNode = childNodes[i]; childNode = childNodes[i];
@ -274,7 +274,7 @@ export class Button {
*/ */
private _readAttrs(element: HTMLElement) { private _readAttrs(element: HTMLElement) {
let elementAttrs = element.attributes; let elementAttrs = element.attributes;
let attrName; let attrName: string;
for (let i = 0, l = elementAttrs.length; i < l; i++) { for (let i = 0, l = elementAttrs.length; i < l; i++) {
if (elementAttrs[i].value !== '') continue; if (elementAttrs[i].value !== '') continue;
@ -345,9 +345,9 @@ export class Button {
/** /**
* @private * @private
*/ */
static setRoles(contentButtonChildren, role: string) { static setRoles(contentButtonChildren: any, role: string) {
let buttons = contentButtonChildren.toArray(); let buttons = contentButtonChildren.toArray();
buttons.forEach(button => { buttons.forEach((button: any) => {
button.setRole(role); button.setRole(role);
}); });
} }

View File

@ -102,7 +102,7 @@ export class Checkbox {
* @private * @private
*/ */
@HostListener('click', ['$event']) @HostListener('click', ['$event'])
private _click(ev) { private _click(ev: UIEvent) {
console.debug('checkbox, checked'); console.debug('checkbox, checked');
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();
@ -158,7 +158,7 @@ export class Checkbox {
/** /**
* @private * @private
*/ */
registerOnTouched(fn) { this.onTouched = fn; } registerOnTouched(fn: any) { this.onTouched = fn; }
/** /**
* @input {boolean} whether or not the checkbox is disabled or not. * @input {boolean} whether or not the checkbox is disabled or not.

View File

@ -111,49 +111,49 @@ export class Content extends Ion {
/** /**
* @private * @private
*/ */
addScrollListener(handler) { addScrollListener(handler: any) {
return this._addListener('scroll', handler); return this._addListener('scroll', handler);
} }
/** /**
* @private * @private
*/ */
addTouchStartListener(handler) { addTouchStartListener(handler: any) {
return this._addListener('touchstart', handler); return this._addListener('touchstart', handler);
} }
/** /**
* @private * @private
*/ */
addTouchMoveListener(handler) { addTouchMoveListener(handler: any) {
return this._addListener('touchmove', handler); return this._addListener('touchmove', handler);
} }
/** /**
* @private * @private
*/ */
addTouchEndListener(handler) { addTouchEndListener(handler: any) {
return this._addListener('touchend', handler); return this._addListener('touchend', handler);
} }
/** /**
* @private * @private
*/ */
addMouseDownListener(handler) { addMouseDownListener(handler: any) {
return this._addListener('mousedown', handler); return this._addListener('mousedown', handler);
} }
/** /**
* @private * @private
*/ */
addMouseUpListener(handler) { addMouseUpListener(handler: any) {
return this._addListener('mouseup', handler); return this._addListener('mouseup', handler);
} }
/** /**
* @private * @private
*/ */
addMouseMoveListener(handler) { addMouseMoveListener(handler: any) {
return this._addListener('mousemove', handler); return this._addListener('mousemove', handler);
} }
@ -177,8 +177,8 @@ export class Content extends Ion {
* @param {Function} callback The method you want perform when scrolling has ended * @param {Function} callback The method you want perform when scrolling has ended
*/ */
onScrollEnd(callback: Function) { onScrollEnd(callback: Function) {
let lastScrollTop = null; let lastScrollTop: number = null;
let framesUnchanged = 0; let framesUnchanged: number = 0;
let _scrollEle = this._scrollEle; let _scrollEle = this._scrollEle;
function next() { function next() {
@ -187,6 +187,7 @@ export class Content extends Ion {
if (Math.round(lastScrollTop) === Math.round(currentScrollTop)) { if (Math.round(lastScrollTop) === Math.round(currentScrollTop)) {
framesUnchanged++; framesUnchanged++;
} else { } else {
framesUnchanged = 0; framesUnchanged = 0;
} }

View File

@ -433,7 +433,7 @@ export class DateTime {
} }
@HostListener('click', ['$event']) @HostListener('click', ['$event'])
private _click(ev) { private _click(ev: UIEvent) {
if (ev.detail === 0) { if (ev.detail === 0) {
// do not continue if the click event came from a form submit // do not continue if the click event came from a form submit
return; return;
@ -443,8 +443,8 @@ export class DateTime {
this.open(); this.open();
} }
@HostListener('keyup.space', ['$event']) @HostListener('keyup.space')
private _keyup(ev) { private _keyup() {
if (!this._isOpen) { if (!this._isOpen) {
this.open(); this.open();
} }
@ -474,7 +474,7 @@ export class DateTime {
}, },
{ {
text: this.doneText, text: this.doneText,
handler: (data) => { handler: (data: any) => {
console.log('datetime, done', data); console.log('datetime, done', data);
this.onChange(data); this.onChange(data);
this.ionChange.emit(data); this.ionChange.emit(data);
@ -594,7 +594,7 @@ export class DateTime {
// default to assuming this month has 31 days // default to assuming this month has 31 days
let numDaysInMonth = 31; let numDaysInMonth = 31;
let selectedMonth; let selectedMonth: number;
if (monthCol) { if (monthCol) {
monthOpt = monthCol.options[monthCol.selectedIndex]; monthOpt = monthCol.options[monthCol.selectedIndex];
if (monthOpt) { if (monthOpt) {
@ -655,7 +655,7 @@ export class DateTime {
*/ */
divyColumns(picker: Picker) { divyColumns(picker: Picker) {
let pickerColumns = picker.getColumns(); let pickerColumns = picker.getColumns();
let columns = []; let columns: number[] = [];
pickerColumns.forEach((col, i) => { pickerColumns.forEach((col, i) => {
columns.push(0); columns.push(0);
@ -803,7 +803,7 @@ export class DateTime {
/** /**
* @private * @private
*/ */
registerOnTouched(fn) { this.onTouched = fn; } registerOnTouched(fn: any) { this.onTouched = fn; }
/** /**
* @private * @private
@ -845,7 +845,7 @@ function convertToArrayOfNumbers(input: any, type: string): number[] {
if (isArray(input)) { if (isArray(input)) {
// ensure each value is an actual number in the returned array // ensure each value is an actual number in the returned array
input.forEach(num => { input.forEach((num: any) => {
num = parseInt(num, 10); num = parseInt(num, 10);
if (!isNaN(num)) { if (!isNaN(num)) {
values.push(num); values.push(num);
@ -877,7 +877,7 @@ function convertToArrayOfStrings(input: any, type: string): string[] {
if (isArray(input)) { if (isArray(input)) {
// trim up each string value // trim up each string value
input.forEach(val => { input.forEach((val: any) => {
val = val.trim(); val = val.trim();
if (val) { if (val) {
values.push(val); values.push(val);

View File

@ -147,7 +147,7 @@ export class InfiniteScroll {
_content.addCssClass('has-infinite-scroll'); _content.addCssClass('has-infinite-scroll');
} }
private _onScroll(ev) { private _onScroll() {
if (this.state === STATE_LOADING || this.state === STATE_DISABLED) { if (this.state === STATE_LOADING || this.state === STATE_DISABLED) {
return 1; return 1;
} }

View File

@ -92,15 +92,15 @@ export class TextInput extends InputBase {
/** /**
* @private * @private
*/ */
inputBlurred(event) { inputBlurred(ev: UIEvent) {
this.blur.emit(event); this.blur.emit(ev);
} }
/** /**
* @private * @private
*/ */
inputFocused(event) { inputFocused(ev: UIEvent) {
this.focus.emit(event); this.focus.emit(ev);
} }
/** /**
@ -193,14 +193,14 @@ export class TextArea extends InputBase {
/** /**
* @private * @private
*/ */
inputBlurred(event) { inputBlurred(ev: UIEvent) {
this.blur.emit(event); this.blur.emit(ev);
} }
/** /**
* @private * @private
*/ */
inputFocused(event) { inputFocused(ev: UIEvent) {
this.focus.emit(event); this.focus.emit(ev);
} }
} }

View File

@ -144,13 +144,13 @@ export class Config {
// the user config's platforms, which already contains // the user config's platforms, which already contains
// settings from default platform configs // settings from default platform configs
let userPlatformValue = undefined; let userPlatformValue: any = undefined;
let userDefaultValue = this._s[key]; let userDefaultValue: any = this._s[key];
let userPlatformModeValue = undefined; let userPlatformModeValue: any = undefined;
let userDefaultModeValue = undefined; let userDefaultModeValue: any = undefined;
let platformValue = undefined; let platformValue: any = undefined;
let platformModeValue = undefined; let platformModeValue: any = undefined;
let configObj = null; let configObj: any = null;
if (this.platform) { if (this.platform) {
let queryStringValue = this.platform.query('ionic' + key.toLowerCase()); let queryStringValue = this.platform.query('ionic' + key.toLowerCase());
@ -223,7 +223,7 @@ export class Config {
// or it was from the users platform configs // or it was from the users platform configs
// or it was from the default platform configs // or it was from the default platform configs
// in that order // in that order
let rtnVal; let rtnVal: any;
if (isFunction(this._c[key])) { if (isFunction(this._c[key])) {
rtnVal = this._c[key](this.platform); rtnVal = this._c[key](this.platform);
@ -345,24 +345,24 @@ export class Config {
/** /**
* @private * @private
*/ */
setPlatform(platform) { setPlatform(platform: Platform) {
this.platform = platform; this.platform = platform;
} }
/** /**
* @private * @private
*/ */
static setModeConfig(mode, config) { static setModeConfig(mode: string, config: any) {
modeConfigs[mode] = config; modeConfigs[mode] = config;
} }
/** /**
* @private * @private
*/ */
static getModeConfig(mode) { static getModeConfig(mode: string) {
return modeConfigs[mode] || null; return modeConfigs[mode] || null;
} }
} }
let modeConfigs = {}; let modeConfigs: any = {};

View File

@ -31,7 +31,7 @@ export interface PageMetadata {
* @private * @private
*/ */
export function Page(config: PageMetadata) { export function Page(config: PageMetadata) {
return function(cls) { return function(cls: any) {
// deprecated warning: added beta.8 2016-05-27 // deprecated warning: added beta.8 2016-05-27
console.warn('@Page decorator has been deprecated. Please use Angular\'s @Component instead.\nimport {Component} from \'@angular/core\';'); console.warn('@Page decorator has been deprecated. Please use Angular\'s @Component instead.\nimport {Component} from \'@angular/core\';');

View File

@ -5,7 +5,7 @@ import {defaults} from '../util';
export class DragGesture extends Gesture { export class DragGesture extends Gesture {
public dragging: boolean; public dragging: boolean;
constructor(element, opts = {}) { constructor(element: HTMLElement, opts = {}) {
defaults(opts, {}); defaults(opts, {});
super(element, opts); super(element, opts);
} }
@ -13,20 +13,20 @@ export class DragGesture extends Gesture {
listen() { listen() {
super.listen(); super.listen();
this.on('panstart', ev => { this.on('panstart', (ev: UIEvent) => {
if (this.onDragStart(ev) !== false) { if (this.onDragStart(ev) !== false) {
this.dragging = true; this.dragging = true;
} }
}); });
this.on('panmove', ev => { this.on('panmove', (ev: UIEvent) => {
if (!this.dragging) return; if (!this.dragging) return;
if (this.onDrag(ev) === false) { if (this.onDrag(ev) === false) {
this.dragging = false; this.dragging = false;
} }
}); });
this.on('panend', ev => { this.on('panend', (ev: UIEvent) => {
if (!this.dragging) return; if (!this.dragging) return;
this.onDragEnd(ev); this.onDragEnd(ev);
this.dragging = false; this.dragging = false;

View File

@ -16,7 +16,7 @@ export class Gesture {
public direction: string; public direction: string;
public isListening: boolean = false; public isListening: boolean = false;
constructor(element, opts: any = {}) { constructor(element: HTMLElement, opts: any = {}) {
defaults(opts, { defaults(opts, {
domEvents: true domEvents: true
}); });
@ -55,11 +55,13 @@ export class Gesture {
} }
unlisten() { unlisten() {
var type, i; let eventType: string;
let i: number;
if (this._hammer && this.isListening) { if (this._hammer && this.isListening) {
for (type in this._callbacks) { for (eventType in this._callbacks) {
for (i = 0; i < this._callbacks[type].length; i++) { for (i = 0; i < this._callbacks[eventType].length; i++) {
this._hammer.off(type, this._callbacks[type]); this._hammer.off(eventType, this._callbacks[eventType]);
} }
} }
this._hammer.destroy(); this._hammer.destroy();

View File

@ -33,7 +33,7 @@ export class SlideEdgeGesture extends SlideGesture {
}; };
} }
_checkEdge(edge, pos) { _checkEdge(edge: string, pos: any) {
switch (edge) { switch (edge) {
case 'left': return pos.x <= this._d.left + this.maxEdgeStart; case 'left': return pos.x <= this._d.left + this.maxEdgeStart;
case 'right': return pos.x >= this._d.width - this.maxEdgeStart; case 'right': return pos.x >= this._d.width - this.maxEdgeStart;

View File

@ -5,7 +5,7 @@ import {clamp} from '../util';
export class SlideGesture extends DragGesture { export class SlideGesture extends DragGesture {
public slide: SlideData = null; public slide: SlideData = null;
constructor(element, opts = {}) { constructor(element: HTMLElement, opts = {}) {
super(element, opts); super(element, opts);
this.element = element; this.element = element;
} }

View File

@ -43,7 +43,7 @@ export class Platform {
private _resizeTm: any; private _resizeTm: any;
private _zone: NgZone; private _zone: NgZone;
constructor(platforms = []) { constructor(platforms: string[] = []) {
this._platforms = platforms; this._platforms = platforms;
this._readyPromise = new Promise(res => { this._readyResolve = res; } ); this._readyPromise = new Promise(res => { this._readyResolve = res; } );
} }
@ -727,8 +727,8 @@ class PlatformNode {
return this; return this;
} }
let platform = null; let platform: PlatformNode = null;
let rootPlatform = null; let rootPlatform: PlatformNode = null;
for (let i = 0; i < parents.length; i++) { for (let i = 0; i < parents.length; i++) {
platform = new PlatformNode(parents[i]); platform = new PlatformNode(parents[i]);
@ -745,11 +745,11 @@ class PlatformNode {
return null; return null;
} }
getSubsetParents(subsetPlatformName: string): Array<string> { getSubsetParents(subsetPlatformName: string): string[] {
let platformRegistry = Platform.registry(); let platformRegistry = Platform.registry();
let parentPlatformNames = []; let parentPlatformNames: string[] = [];
let platform = null; let platform: PlatformConfig = null;
for (let platformName in platformRegistry) { for (let platformName in platformRegistry) {
platform = platformRegistry[platformName]; platform = platformRegistry[platformName];

View File

@ -3,7 +3,8 @@ import {nativeTimeout} from './dom';
const CSS_CLICK_BLOCK = 'click-block-active'; const CSS_CLICK_BLOCK = 'click-block-active';
const DEFAULT_EXPIRE = 330; const DEFAULT_EXPIRE = 330;
let cbEle, fallbackTimerId; let cbEle: HTMLElement;
let fallbackTimerId: number;
let isShowing = false; let isShowing = false;
/** /**
@ -15,14 +16,14 @@ export class ClickBlock {
enable() { enable() {
cbEle = document.createElement('click-block'); cbEle = document.createElement('click-block');
document.body.appendChild(cbEle); document.body.appendChild(cbEle);
cbEle.addEventListener('touchmove', function(ev) { cbEle.addEventListener('touchmove', function(ev: UIEvent) {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();
}); });
this._enabled = true; this._enabled = true;
} }
show(shouldShow, expire) { show(shouldShow: boolean, expire: number) {
if (this._enabled) { if (this._enabled) {
if (shouldShow) { if (shouldShow) {
show(expire); show(expire);
@ -35,7 +36,7 @@ export class ClickBlock {
} }
function show(expire) { function show(expire: number) {
clearTimeout(fallbackTimerId); clearTimeout(fallbackTimerId);
fallbackTimerId = nativeTimeout(hide, expire || DEFAULT_EXPIRE); fallbackTimerId = nativeTimeout(hide, expire || DEFAULT_EXPIRE);

View File

@ -6,7 +6,7 @@ export function renderDateTime(template: string, value: DateTimeData, locale: Lo
return ''; return '';
} }
let tokens = []; let tokens: string[] = [];
let hasText = false; let hasText = false;
FORMAT_KEYS.forEach((format, index) => { FORMAT_KEYS.forEach((format, index) => {
if (template.indexOf(format.f) > -1) { if (template.indexOf(format.f) > -1) {