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;
}
export interface Callback<T> {
(error: Error, parameter: T): 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;
}
export type Callback<T> = (error: Error, parameter: T) => void;
export type SuccessCallback<T> = (result?: T) => void;
export type ErrorCallback = (error?: Error) => void;
interface Configuration {
appVersion: string;

View File

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

View File

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

View File

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