refactor: follow callable-types lint rule

This commit is contained in:
Daniel 2018-09-17 16:18:31 +02:00
parent 26a8df9b7c
commit 89ed51cc49
4 changed files with 16 additions and 68 deletions

View File

@ -156,23 +156,9 @@ interface NativeUpdateNotification {
appVersion: string; appVersion: string;
} }
export interface Callback<T> { export type Callback<T> = (error: Error, parameter: T) => void;
(error: Error, parameter: T): void; export type SuccessCallback<T> = (result?: T) => void;
} export type ErrorCallback = (error?: Error) => void;
export interface SuccessCallback<T> {
(result?: T): void;
}
export interface ErrorCallback {
(error?: Error): void;
}
export interface SuccessCallback<T> {
(result?: T): void;
}
export interface ErrorCallback {
(error?: Error): void;
}
interface Configuration { interface Configuration {
appVersion: string; appVersion: string;

View File

@ -405,84 +405,52 @@ export interface FileEntry extends Entry {
/** /**
* When requestFileSystem() succeeds, the following callback is made. * When requestFileSystem() succeeds, the following callback is made.
*/ */
export interface FileSystemCallback { export type FileSystemCallback = (filesystem: FileSystem) => void;
/**
* @param filesystem The file systems to which the app is granted access.
*/
(filesystem: FileSystem): void;
}
/** /**
* This export interface is the callback used to look up Entry objects. * This export interface is the callback used to look up Entry objects.
*/ */
export interface EntryCallback { export type EntryCallback = (entry: Entry) => void;
/**
* @param entry
*/
(entry: Entry): void;
}
/** /**
* This export interface is the callback used to look up FileEntry objects. * This export interface is the callback used to look up FileEntry objects.
*/ */
export interface FileEntryCallback { export type FileEntryCallback = (entry: FileEntry) => void;
/**
* @param entry
*/
(entry: FileEntry): void;
}
/** /**
* This export interface is the callback used to look up DirectoryEntry objects. * This export interface is the callback used to look up DirectoryEntry objects.
*/ */
export interface DirectoryEntryCallback { export type DirectoryEntryCallback = (entry: DirectoryEntry) => void;
/**
* @param entry
*/
(entry: DirectoryEntry): void;
}
/** /**
* When readEntries() succeeds, the following callback is made. * When readEntries() succeeds, the following callback is made.
*/ */
export interface EntriesCallback { export type EntriesCallback = (entries: Entry[]) => void;
(entries: Entry[]): void;
}
/** /**
* This export interface is the callback used to look up file and directory metadata. * This export interface is the callback used to look up file and directory metadata.
*/ */
export interface MetadataCallback { export type MetadataCallback = (metadata: Metadata) => void;
(metadata: Metadata): void;
}
/** /**
* This export interface is the callback used to create a FileWriter. * This export interface is the callback used to create a FileWriter.
*/ */
export interface FileWriterCallback { export type FileWriterCallback = (fileWriter: FileWriter) => void;
(fileWriter: FileWriter): void;
}
/** /**
* This export interface is the callback used to obtain a File. * This export interface is the callback used to obtain a File.
*/ */
export interface FileCallback { export type FileCallback = (file: IFile) => void;
(file: IFile): void;
}
/** /**
* This export interface is the generic callback used to indicate success of an asynchronous method. * This export interface is the generic callback used to indicate success of an asynchronous method.
*/ */
export interface VoidCallback { export type VoidCallback = () => void;
(): void;
}
/** /**
* When an error occurs, the following callback is made. * When an error occurs, the following callback is made.
*/ */
export interface ErrorCallback { export type ErrorCallback = (err: FileError) => void;
(err: FileError): void;
}
export interface RemoveResult { export interface RemoveResult {
success: boolean; success: boolean;
@ -1449,8 +1417,7 @@ export class File extends IonicNativePlugin {
return getPromise<T>((resolve, reject) => { return getPromise<T>((resolve, reject) => {
reader.onloadend = () => { reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) { if (reader.result !== undefined || reader.result !== null) {
/* tslint:disable:no-angle-bracket-type-assertion */ resolve((reader.result as any) as T);
resolve(<T>(<any>reader.result));
} else if (reader.error !== undefined || reader.error !== null) { } else if (reader.error !== undefined || reader.error !== null) {
reject(reader.error); reject(reader.error);
} else { } else {

View File

@ -77,9 +77,5 @@ export class HCE extends IonicNativePlugin {
} }
} }
export interface HCECommandEvent { export type HCECommandEvent = (command: Uint8Array) => void;
(command: Uint8Array): void; export type HCEDeactivatedEvent = (command: number) => void;
}
export interface HCEDeactivatedEvent {
(command: number): void;
}

View File

@ -10,7 +10,6 @@
"no-shadowed-variable": false, "no-shadowed-variable": false,
"only-arrow-functions": false, "only-arrow-functions": false,
"ter-no-proto": false, "ter-no-proto": false,
"callable-types": false,
"adjacent-overload-signatures": false, "adjacent-overload-signatures": false,
"no-constant-condition": false "no-constant-condition": false
} }