refactor(): no implicit any

This commit is contained in:
Ibby Hadeed
2017-05-14 00:55:16 -04:00
parent fec19b734c
commit a28de660bc
37 changed files with 129 additions and 105 deletions
@@ -1,9 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
export interface AppRatePreferences {
/**
@@ -1,9 +1,6 @@
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
declare var window;
export interface BackgroundFetchConfig {
/**
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
export interface BackgroundGeolocationResponse {
/**
+2 -2
View File
@@ -109,8 +109,8 @@ interface LocalPackage_Static {
}
/* tslint:enable */
declare var RemotePackage: RemotePackage_Static;
declare var LocalPackage: LocalPackage_Static;
declare const RemotePackage: RemotePackage_Static;
declare const LocalPackage: LocalPackage_Static;
/**
* Defines the JSON format of the current package information file.
+12 -9
View File
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var window: any,
declare const window: any,
navigator: any;
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
@@ -49,6 +49,7 @@ export interface IContactProperties {
/** An array of web pages associated with the contact. */
urls?: IContactField[];
}
/**
@@ -71,6 +72,8 @@ export class Contact implements IContactProperties {
@InstanceProperty categories: IContactField[];
@InstanceProperty urls: IContactField[];
[key: string]: any;
constructor() {
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
this._objectInstance = navigator.contacts.create();
@@ -92,8 +95,8 @@ export class Contact implements IContactProperties {
@InstanceCheck()
save(): Promise<any> {
return getPromise((resolve, reject) => {
this._objectInstance.save((contact) => {
return getPromise((resolve: Function, reject: Function) => {
this._objectInstance.save((contact: any) => {
this._objectInstance = contact;
resolve(this);
}, reject);
@@ -114,7 +117,7 @@ export interface IContactError {
/**
* @hidden
*/
export declare var ContactError: {
export declare const ContactError: {
new (code: number): IContactError;
UNKNOWN_ERROR: number;
INVALID_ARGUMENT_ERROR: number;
@@ -312,8 +315,8 @@ export class Contacts extends IonicNativePlugin {
*/
@CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => {
navigator.contacts.find(fields, (contacts) => {
return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.find(fields, (contacts: any[]) => {
resolve(contacts.map(processContact));
}, reject, options);
});
@@ -325,8 +328,8 @@ export class Contacts extends IonicNativePlugin {
*/
@CordovaCheck()
pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject);
});
}
@@ -335,7 +338,7 @@ export class Contacts extends IonicNativePlugin {
/**
* @hidden
*/
function processContact(contact) {
function processContact(contact: any) {
let newContact = new Contact();
for (let prop in contact) {
if (typeof contact[prop] === 'function') continue;
+2 -2
View File
@@ -98,7 +98,7 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({
observable: true
})
route(paths): Observable<DeeplinkMatch> { return; }
route(paths: any): Observable<DeeplinkMatch> { return; }
/**
*
@@ -121,6 +121,6 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({
observable: true
})
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
routeWithNavController(navController: any, paths: any): Observable<DeeplinkMatch> { return; }
}
+1 -1
View File
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window: any;
declare const window: any;
/**
* @name Device
+1 -1
View File
@@ -75,7 +75,7 @@ export class Dialogs extends IonicNativePlugin {
successIndex: 1,
errorIndex: 4
})
confirm(message, title?: string, buttonLabels?: string[]): Promise<number> { return; }
confirm(message: string, title?: string, buttonLabels?: string[]): Promise<number> { return; }
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
@@ -1,7 +1,11 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var cordova: any;
interface Cordova {
plugins: CordovaPlugins & { email: any };
}
declare const cordova: Cordova;
export interface EmailComposerOptions {
@@ -88,7 +92,7 @@ export class EmailComposer extends IonicNativePlugin {
isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
if (app) {
cordova.plugins.email.isAvailable(app, (isAvailable) => {
cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
@@ -96,7 +100,7 @@ export class EmailComposer extends IonicNativePlugin {
}
});
} else {
cordova.plugins.email.isAvailable((isAvailable) => {
cordova.plugins.email.isAvailable((isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
+1 -1
View File
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
declare var window: any;
declare const window: any;
/**
* @name File Path
+6 -1
View File
@@ -517,6 +517,11 @@ export declare class FileReader {
readAsBinaryString(fe: IFile): void;
readAsArrayBuffer(fe: IFile): void;
/**
* @hidden
*/
[key: string]: any;
}
interface Window extends LocalFileSystem {}
@@ -630,7 +635,7 @@ export class File extends IonicNativePlugin {
@CordovaProperty
sharedDirectory: string;
cordovaFileError: {} = {
cordovaFileError: any = {
1: 'NOT_FOUND_ERR',
2: 'SECURITY_ERR',
3: 'ABORT_ERR',
+1 -1
View File
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaFunctionOverride, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window: any;
declare const window: any;
/**
* @name Geofence
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
declare const navigator: any;
export interface Coordinates {
@@ -174,7 +174,7 @@ export class Geolocation extends IonicNativePlugin {
* Observable changes.
*
* ```typescript
* var subscription = this.geolocation.watchPosition()
* const subscription = this.geolocation.watchPosition()
* .filter((p) => p.coords !== undefined) //Filter Out Errors
* .subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);
@@ -1,8 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
/**
* @name Google Analytics
* @description
@@ -3,7 +3,7 @@ import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, Insta
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var plugin: any;
declare const plugin: any;
/**
* @hidden
@@ -1473,7 +1473,7 @@ export class GroundOverlay {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
(resolve: Function) => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
@@ -1766,7 +1766,7 @@ export class Geocoder {
*/
@CordovaCheck()
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
return new Promise<GeocoderResult[]>(resolve => {
return new Promise<GeocoderResult[]>((resolve: Function) => {
plugin.google.maps.Geocoder.geocode(request, resolve);
});
}
+1 -1
View File
@@ -2,7 +2,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
declare var navigator: any;
declare const navigator: any;
/**
* @hidden
+1 -1
View File
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
declare const cordova: any;
export interface Beacon {
/**
@@ -3,7 +3,7 @@ import { Plugin, CordovaInstance, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var cordova: any;
declare const cordova: Cordova & { InAppBrowser: any; };
export interface InAppBrowserOptions {
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
@@ -48,6 +48,11 @@ export interface InAppBrowserOptions {
/** (Windows only) Set to yes to create the browser control without a border around it.
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
fullscreen?: 'yes';
/**
* @hidden
*/
[key: string]: any;
}
export interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
@@ -80,12 +85,18 @@ export class InAppBrowserObject {
*/
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
try {
if (options && typeof options !== 'string')
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
if (options && typeof options !== 'string') {
options = Object.keys(options).map((key: string) => `${key}=${(<InAppBrowserOptions>options)[key]}`).join(',');
}
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) {
window.open(url);
window.open(url, target);
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
}
}
@@ -1,7 +1,7 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
declare var window: any;
declare const window: any;
export interface IntelSecurityDataOptions {
/** Non-empty string. **/
+1 -1
View File
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Plugin, Cordova, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
declare const cordova: any;
/**
* @name Jins Meme
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
declare const navigator: any;
export interface MediaFile {
/**
@@ -33,7 +33,7 @@ export interface MediaFile {
* @param {Function} successCallback
* @param {Function} errorCallback
*/
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): void;
}
export interface MediaFileData {
+2 -2
View File
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var Media: any;
declare const Media: any;
/**
@@ -169,7 +169,7 @@ export type MediaErrorCallback = (error: MediaError) => void;
* window.setTimeout(() => file.stopRecord(), 10000);
* });
* ```
*
*
* You can find the reasons here: https://github.com/driftyco/ionic-native/issues/1452#issuecomment-299605906
*
* @usage
+7 -1
View File
@@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @name PayPal
* @description
@@ -383,6 +384,11 @@ export interface PayPalConfigurationOptions {
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
*/
sandboxUserPin?: string;
/**
* @hidden
*/
[key: string]: any;
}
/**
* @hidden
@@ -413,7 +419,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
};
if (options && typeof options === 'object') {
for (var i in options) {
for (let i in options) {
if (defaults.hasOwnProperty(i)) {
defaults[i] = options[i];
}
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
/**
* @name Screen Orientation
* @description
@@ -1,8 +1,8 @@
import { Injectable } from '@angular/core';
import { Plugin, IonicNativePlugin } from '@ionic-native/core';
declare const navigator: any;
declare var navigator: any;
/**
* @name Screenshot
* @description Captures a screen shot
@@ -44,7 +44,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.save(
(error, result) => {
(error: any, result: any) => {
if (error) {
reject(error);
} else {
@@ -70,7 +70,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.URI(
(error, result) => {
(error: any, result: any) => {
if (error) {
reject(error);
} else {
@@ -1,9 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
/**
* @name Status Bar
* @description
+1 -1
View File
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
declare var FileTransfer;
declare const FileTransfer: any;
export interface FileUploadOptions {
@@ -28,9 +28,9 @@ export interface MediaFile {
/**
* Retrieves the format information of the media file.
* @param {Function} successCallback
* @param {Function} errorCallback
* @param {Function} [errorCallback]
*/
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): any;
}
export interface MediaFileData {
@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
/**
* @beta
* @name Web Intent