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

View File

@ -53,14 +53,17 @@ const PLUGINS = fs.readdirSync(PLUGINS_PATH);
// Build specific list of plugins to build from arguments, if any // Build specific list of plugins to build from arguments, if any
let pluginsToBuild = process.argv.slice(2); let pluginsToBuild = process.argv.slice(2);
let ignoreErrors = false; let ignoreErrors = false;
if (!pluginsToBuild.length) { let errors = [];
pluginsToBuild = PLUGINS;
} else { const index = pluginsToBuild.indexOf('ignore-errors');
const index = pluginsToBuild.indexOf('--ignore-errors');
if (index > -1) { if (index > -1) {
ignoreErrors = true; ignoreErrors = true;
pluginsToBuild.splice(index, 1); pluginsToBuild.splice(index, 1);
console.log('Build will continue even if errors were thrown. Errors will be printed when build finishes.');
} }
if (!pluginsToBuild.length) {
pluginsToBuild = PLUGINS;
} }
// Create a queue to process tasks // Create a queue to process tasks
@ -109,12 +112,14 @@ const addPluginToQueue = pluginName => {
exec(`${ROOT}/node_modules/.bin/ngc -p ${tsConfigPath}`, (err, stdout, stderr) => { exec(`${ROOT}/node_modules/.bin/ngc -p ${tsConfigPath}`, (err, stdout, stderr) => {
if (err) { if (err) {
console.log(err);
if (!ignoreErrors) { if (!ignoreErrors) {
// oops! something went wrong. // oops! something went wrong.
console.log(err);
callback(`\n\nBuilding ${pluginName} failed.`); callback(`\n\nBuilding ${pluginName} failed.`);
return; return;
} else {
errors.push(err);
} }
} }
@ -137,6 +142,9 @@ QUEUE.start((err) => {
if (err) { if (err) {
console.log('Error building plugins. ', err); console.log('Error building plugins. ', err);
} else if (errors.length) {
errors.forEach(e => console.log(e.message) && console.log('\n'));
console.log('Build complete with errors');
} else { } else {
console.log('Done processing plugins!'); console.log('Done processing plugins!');
} }

View File

@ -13,7 +13,8 @@
"skipLibCheck": true, "skipLibCheck": true,
"lib": ["es2015", "dom"], "lib": ["es2015", "dom"],
"sourceMap": true, "sourceMap": true,
"inlineSources": true "inlineSources": true,
"noImplicitAny": true
}, },
"files": [ "files": [
"../../src/@ionic-native/core/index.ts" "../../src/@ionic-native/core/index.ts"

View File

@ -16,7 +16,8 @@
"skipLibCheck": true, "skipLibCheck": true,
"lib": ["es2015", "dom"], "lib": ["es2015", "dom"],
"sourceMap": true, "sourceMap": true,
"inlineSources": true "inlineSources": true,
"noImplicitAny": true
}, },
"files": [] "files": []
} }

View File

@ -1,5 +1,3 @@
declare var window;
export function checkReady() { export function checkReady() {
const DEVICE_READY_TIMEOUT = 5000; const DEVICE_READY_TIMEOUT = 5000;
@ -16,7 +14,7 @@ export function checkReady() {
}); });
setTimeout(() => { setTimeout(() => {
if (!didFireReady && window.cordova) { if (!didFireReady && !!window.cordova) {
console.warn(`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`); console.warn(`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`);
} }
}, DEVICE_READY_TIMEOUT); }, DEVICE_READY_TIMEOUT);

View File

@ -32,6 +32,8 @@ export interface PluginConfig {
* Supported platforms * Supported platforms
*/ */
platforms?: string[]; platforms?: string[];
[key: string]: any;
} }
export interface CordovaOptions { export interface CordovaOptions {
@ -182,12 +184,12 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
* } * }
* ``` * ```
*/ */
export function Plugin(config: PluginConfig) { export function Plugin(config: PluginConfig): ClassDecorator {
return function(cls) { return function(cls: any) {
// Add these fields to the class // Add these fields to the class
for (let k in config) { for (let prop in config) {
cls[k] = config[k]; cls[prop] = config[prop];
} }
cls['installed'] = function(printWarning?: boolean) { cls['installed'] = function(printWarning?: boolean) {

View File

@ -7,8 +7,8 @@ import 'rxjs/add/observable/fromEvent';
checkReady(); checkReady();
declare var window; // declare const window;
declare var Promise; // declare var Promise;
/** /**
@ -16,8 +16,8 @@ declare var Promise;
* @return {boolean | { error: string } } * @return {boolean | { error: string } }
* @private * @private
*/ */
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string); export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string); export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } { export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } {
let pluginRef, pluginInstance, pluginPackage; let pluginRef, pluginInstance, pluginPackage;
@ -69,7 +69,7 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
args.unshift(reject); args.unshift(reject);
args.unshift(resolve); args.unshift(resolve);
} else if (opts.callbackStyle === 'node') { } else if (opts.callbackStyle === 'node') {
args.push((err, result) => { args.push((err: any, result: any) => {
if (err) { if (err) {
reject(err); reject(err);
} else { } else {
@ -135,8 +135,8 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
} }
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) { function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
let pluginResult, rej; let pluginResult: any, rej: Function;
const p = getPromise((resolve, reject) => { const p = getPromise((resolve: Function, reject: Function) => {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject); pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
rej = reject; rej = reject;
}); });
@ -145,13 +145,13 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any
// to error // to error
if (pluginResult && pluginResult.error) { if (pluginResult && pluginResult.error) {
p.catch(() => { }); p.catch(() => { });
rej(pluginResult.error); typeof rej === 'function' && rej(pluginResult.error);
} }
return p; return p;
} }
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) { function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
return getPromise((resolve, reject) => { return getPromise((resolve: Function, reject: Function) => {
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts); const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) { if (pluginResult) {
if (pluginResult.error) { if (pluginResult.error) {
@ -239,7 +239,7 @@ export function overrideFunction(pluginObj: any, methodName: string, args: any[]
* @private * @private
*/ */
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) { export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
return (...args) => { return (...args: any[]) => {
if (opts.sync) { if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is // Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
return callCordovaPlugin(pluginObj, methodName, args, opts); return callCordovaPlugin(pluginObj, methodName, args, opts);
@ -259,7 +259,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOp
* @private * @private
*/ */
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) { export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
return (...args) => { return (...args: any[]) => {
if (opts.sync) { if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts); return callInstance(pluginObj, methodName, args, opts);
@ -289,7 +289,7 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
} else if (opts.otherPromise) { } else if (opts.otherPromise) {
return getPromise((resolve, reject) => { return getPromise((resolve: Function, reject: Function) => {
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject); let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
if (result && !result.error) { if (result && !result.error) {
result.then(resolve, reject); result.then(resolve, reject);
@ -298,14 +298,14 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
} else { } else {
let pluginResult, rej; let pluginResult: any, rej: Function;
const p = getPromise((resolve, reject) => { const p = getPromise((resolve: Function, reject: Function) => {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject); pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
rej = reject; rej = reject;
}); });
if (pluginResult && pluginResult.error) { if (pluginResult && pluginResult.error) {
p.catch(() => { }); p.catch(() => { });
rej(pluginResult.error); typeof rej === 'function' && rej(pluginResult.error);
} }
return p; return p;

View File

@ -1,27 +1,28 @@
declare var window: any; declare const window: any;
/** /**
* @private * @private
*/ */
export function get(obj, path) { export const get = (element: Element | Window, path: string): any => {
path = path.split('.'); const paths: string[] = path.split('.');
for (let i = 0; i < path.length; i++) { let obj: any = element;
for (let i: number = 0; i < paths.length; i++) {
if (!obj) { return null; } if (!obj) { return null; }
obj = obj[path[i]]; obj = obj[paths[i]];
} }
return obj; return obj;
} };
/** /**
* @private * @private
*/ */
export function getPromise(cb) { export const getPromise = (callback: Function): Promise<any> => {
const tryNativePromise = () => { const tryNativePromise = () => {
if (window.Promise) { if (window.Promise) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
cb(resolve, reject); callback(resolve, reject);
}); });
} else { } else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 2 or on a recent browser.'); console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 2 or on a recent browser.');
@ -29,21 +30,21 @@ export function getPromise(cb) {
}; };
return tryNativePromise(); return tryNativePromise();
} };
/** /**
* @private * @private
* @param pluginRef * @param pluginRef
* @returns {null|*} * @returns {null|*}
*/ */
export function getPlugin(pluginRef: string): any { export const getPlugin = (pluginRef: string): any => {
return get(window, pluginRef); return get(window, pluginRef);
}; };
/** /**
* @private * @private
*/ */
export const pluginWarn = function(pluginName: string, plugin?: string, method?: string) { export const pluginWarn = (pluginName: string, plugin?: string, method?: string): void => {
if (method) { if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.'); console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
} else { } else {
@ -59,7 +60,7 @@ export const pluginWarn = function(pluginName: string, plugin?: string, method?:
* @param pluginName * @param pluginName
* @param method * @param method
*/ */
export const cordovaWarn = function(pluginName: string, method?: string) { export const cordovaWarn = (pluginName: string, method?: string): void => {
if (method) { if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator'); console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
} else { } else {

View File

@ -1,9 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
export interface AppRatePreferences { export interface AppRatePreferences {
/** /**

View File

@ -1,9 +1,6 @@
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
declare var window;
export interface BackgroundFetchConfig { export interface BackgroundFetchConfig {
/** /**

View File

@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var window;
export interface BackgroundGeolocationResponse { export interface BackgroundGeolocationResponse {
/** /**

View File

@ -109,8 +109,8 @@ interface LocalPackage_Static {
} }
/* tslint:enable */ /* tslint:enable */
declare var RemotePackage: RemotePackage_Static; declare const RemotePackage: RemotePackage_Static;
declare var LocalPackage: LocalPackage_Static; declare const LocalPackage: LocalPackage_Static;
/** /**
* Defines the JSON format of the current package information file. * Defines the JSON format of the current package information file.

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core'; import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var window: any, declare const window: any,
navigator: 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'; 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. */ /** An array of web pages associated with the contact. */
urls?: IContactField[]; urls?: IContactField[];
} }
/** /**
@ -71,6 +72,8 @@ export class Contact implements IContactProperties {
@InstanceProperty categories: IContactField[]; @InstanceProperty categories: IContactField[];
@InstanceProperty urls: IContactField[]; @InstanceProperty urls: IContactField[];
[key: string]: any;
constructor() { constructor() {
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) { if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
this._objectInstance = navigator.contacts.create(); this._objectInstance = navigator.contacts.create();
@ -92,8 +95,8 @@ export class Contact implements IContactProperties {
@InstanceCheck() @InstanceCheck()
save(): Promise<any> { save(): Promise<any> {
return getPromise((resolve, reject) => { return getPromise((resolve: Function, reject: Function) => {
this._objectInstance.save((contact) => { this._objectInstance.save((contact: any) => {
this._objectInstance = contact; this._objectInstance = contact;
resolve(this); resolve(this);
}, reject); }, reject);
@ -114,7 +117,7 @@ export interface IContactError {
/** /**
* @hidden * @hidden
*/ */
export declare var ContactError: { export declare const ContactError: {
new (code: number): IContactError; new (code: number): IContactError;
UNKNOWN_ERROR: number; UNKNOWN_ERROR: number;
INVALID_ARGUMENT_ERROR: number; INVALID_ARGUMENT_ERROR: number;
@ -312,8 +315,8 @@ export class Contacts extends IonicNativePlugin {
*/ */
@CordovaCheck() @CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> { find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => { return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.find(fields, (contacts) => { navigator.contacts.find(fields, (contacts: any[]) => {
resolve(contacts.map(processContact)); resolve(contacts.map(processContact));
}, reject, options); }, reject, options);
}); });
@ -325,8 +328,8 @@ export class Contacts extends IonicNativePlugin {
*/ */
@CordovaCheck() @CordovaCheck()
pickContact(): Promise<Contact> { pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => { return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject); navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject);
}); });
} }
@ -335,7 +338,7 @@ export class Contacts extends IonicNativePlugin {
/** /**
* @hidden * @hidden
*/ */
function processContact(contact) { function processContact(contact: any) {
let newContact = new Contact(); let newContact = new Contact();
for (let prop in contact) { for (let prop in contact) {
if (typeof contact[prop] === 'function') continue; if (typeof contact[prop] === 'function') continue;

View File

@ -98,7 +98,7 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({ @Cordova({
observable: true observable: true
}) })
route(paths): Observable<DeeplinkMatch> { return; } route(paths: any): Observable<DeeplinkMatch> { return; }
/** /**
* *
@ -121,6 +121,6 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({ @Cordova({
observable: true observable: true
}) })
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; } routeWithNavController(navController: any, paths: any): Observable<DeeplinkMatch> { return; }
} }

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window: any; declare const window: any;
/** /**
* @name Device * @name Device

View File

@ -75,7 +75,7 @@ export class Dialogs extends IonicNativePlugin {
successIndex: 1, successIndex: 1,
errorIndex: 4 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. * Displays a native dialog box that is more customizable than the browser's prompt function.

View File

@ -1,7 +1,11 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/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 { export interface EmailComposerOptions {
@ -88,7 +92,7 @@ export class EmailComposer extends IonicNativePlugin {
isAvailable(app?: string): Promise<any> { isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => { return new Promise<boolean>((resolve, reject) => {
if (app) { if (app) {
cordova.plugins.email.isAvailable(app, (isAvailable) => { cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) { if (isAvailable) {
resolve(); resolve();
} else { } else {
@ -96,7 +100,7 @@ export class EmailComposer extends IonicNativePlugin {
} }
}); });
} else { } else {
cordova.plugins.email.isAvailable((isAvailable) => { cordova.plugins.email.isAvailable((isAvailable: boolean) => {
if (isAvailable) { if (isAvailable) {
resolve(); resolve();
} else { } else {

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
declare var window: any; declare const window: any;
/** /**
* @name File Path * @name File Path

View File

@ -517,6 +517,11 @@ export declare class FileReader {
readAsBinaryString(fe: IFile): void; readAsBinaryString(fe: IFile): void;
readAsArrayBuffer(fe: IFile): void; readAsArrayBuffer(fe: IFile): void;
/**
* @hidden
*/
[key: string]: any;
} }
interface Window extends LocalFileSystem {} interface Window extends LocalFileSystem {}
@ -630,7 +635,7 @@ export class File extends IonicNativePlugin {
@CordovaProperty @CordovaProperty
sharedDirectory: string; sharedDirectory: string;
cordovaFileError: {} = { cordovaFileError: any = {
1: 'NOT_FOUND_ERR', 1: 'NOT_FOUND_ERR',
2: 'SECURITY_ERR', 2: 'SECURITY_ERR',
3: 'ABORT_ERR', 3: 'ABORT_ERR',

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaFunctionOverride, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, Plugin, CordovaFunctionOverride, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var window: any; declare const window: any;
/** /**
* @name Geofence * @name Geofence

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var navigator: any; declare const navigator: any;
export interface Coordinates { export interface Coordinates {
@ -174,7 +174,7 @@ export class Geolocation extends IonicNativePlugin {
* Observable changes. * Observable changes.
* *
* ```typescript * ```typescript
* var subscription = this.geolocation.watchPosition() * const subscription = this.geolocation.watchPosition()
* .filter((p) => p.coords !== undefined) //Filter Out Errors * .filter((p) => p.coords !== undefined) //Filter Out Errors
* .subscribe(position => { * .subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude); * console.log(position.coords.longitude + ' ' + position.coords.latitude);

View File

@ -1,8 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
/** /**
* @name Google Analytics * @name Google Analytics
* @description * @description

View File

@ -3,7 +3,7 @@ import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, Insta
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent'; import 'rxjs/add/observable/fromEvent';
declare var plugin: any; declare const plugin: any;
/** /**
* @hidden * @hidden
@ -1473,7 +1473,7 @@ export class GroundOverlay {
return Promise.reject({ error: 'plugin_not_installed' }); return Promise.reject({ error: 'plugin_not_installed' });
} }
return new Promise<any>( 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() @CordovaCheck()
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> { geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
return new Promise<GeocoderResult[]>(resolve => { return new Promise<GeocoderResult[]>((resolve: Function) => {
plugin.google.maps.Geocoder.geocode(request, resolve); plugin.google.maps.Geocoder.geocode(request, resolve);
}); });
} }

View File

@ -2,7 +2,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
declare var navigator: any; declare const navigator: any;
/** /**
* @hidden * @hidden

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var cordova: any; declare const cordova: any;
export interface Beacon { export interface Beacon {
/** /**

View File

@ -3,7 +3,7 @@ import { Plugin, CordovaInstance, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent'; import 'rxjs/add/observable/fromEvent';
declare var cordova: any; declare const cordova: Cordova & { InAppBrowser: any; };
export interface InAppBrowserOptions { export interface InAppBrowserOptions {
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */ /** 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. /** (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. */ * Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
fullscreen?: 'yes'; fullscreen?: 'yes';
/**
* @hidden
*/
[key: string]: any;
} }
export interface InAppBrowserEvent extends Event { export interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */ /** the eventname, either loadstart, loadstop, loaderror, or exit. */
@ -80,12 +85,18 @@ export class InAppBrowserObject {
*/ */
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) { constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
try { 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); this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) { } 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.'); console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
} }
} }

View File

@ -1,7 +1,7 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
declare var window: any; declare const window: any;
export interface IntelSecurityDataOptions { export interface IntelSecurityDataOptions {
/** Non-empty string. **/ /** Non-empty string. **/

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Plugin, Cordova, CordovaCheck, IonicNativePlugin } from '@ionic-native/core'; import { Plugin, Cordova, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var cordova: any; declare const cordova: any;
/** /**
* @name Jins Meme * @name Jins Meme

View File

@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var navigator: any; declare const navigator: any;
export interface MediaFile { export interface MediaFile {
/** /**
@ -33,7 +33,7 @@ export interface MediaFile {
* @param {Function} successCallback * @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): void;
} }
export interface MediaFileData { export interface MediaFileData {

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core'; import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var Media: any; declare const Media: any;
/** /**

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/** /**
* @name PayPal * @name PayPal
* @description * @description
@ -383,6 +384,11 @@ export interface PayPalConfigurationOptions {
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set. * PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
*/ */
sandboxUserPin?: string; sandboxUserPin?: string;
/**
* @hidden
*/
[key: string]: any;
} }
/** /**
* @hidden * @hidden
@ -413,7 +419,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
}; };
if (options && typeof options === 'object') { if (options && typeof options === 'object') {
for (var i in options) { for (let i in options) {
if (defaults.hasOwnProperty(i)) { if (defaults.hasOwnProperty(i)) {
defaults[i] = options[i]; defaults[i] = options[i];
} }

View File

@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var window;
/** /**
* @name Screen Orientation * @name Screen Orientation
* @description * @description

View File

@ -1,8 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Plugin, IonicNativePlugin } from '@ionic-native/core';
declare const navigator: any;
declare var navigator: any;
/** /**
* @name Screenshot * @name Screenshot
* @description Captures a screen shot * @description Captures a screen shot
@ -44,7 +44,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>( return new Promise<any>(
(resolve, reject) => { (resolve, reject) => {
navigator.screenshot.save( navigator.screenshot.save(
(error, result) => { (error: any, result: any) => {
if (error) { if (error) {
reject(error); reject(error);
} else { } else {
@ -70,7 +70,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>( return new Promise<any>(
(resolve, reject) => { (resolve, reject) => {
navigator.screenshot.URI( navigator.screenshot.URI(
(error, result) => { (error: any, result: any) => {
if (error) { if (error) {
reject(error); reject(error);
} else { } else {

View File

@ -1,9 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
/** /**
* @name Status Bar * @name Status Bar
* @description * @description

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
declare var FileTransfer; declare const FileTransfer: any;
export interface FileUploadOptions { export interface FileUploadOptions {

View File

@ -28,9 +28,9 @@ export interface MediaFile {
/** /**
* Retrieves the format information of the media file. * Retrieves the format information of the media file.
* @param {Function} successCallback * @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 { export interface MediaFileData {

View File

@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
declare var window;
/** /**
* @beta * @beta
* @name Web Intent * @name Web Intent

View File

@ -5,6 +5,7 @@
"stripInternal": true, "stripInternal": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"noImplicitAny": true,
"module": "es2015", "module": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"paths": { "paths": {