Use unknown return type for callbacks
This commit is contained in:
parent
e73f147fbc
commit
81b81e30ff
16 changed files with 95 additions and 76 deletions
|
|
@ -23,9 +23,11 @@ export class LogLine {
|
|||
export class Logger {
|
||||
private static readonly MAX_MESSAGES = 100000;
|
||||
private readonly messages: LogLine[] = [];
|
||||
private readonly onMessageListeners: ((message: LogLine) => void)[] = [];
|
||||
private readonly onMessageListeners: ((message: LogLine) => unknown)[] = [];
|
||||
|
||||
public constructor(...onMessageListeners: ((message: LogLine) => void)[]) {
|
||||
public constructor(
|
||||
...onMessageListeners: ((message: LogLine) => unknown)[]
|
||||
) {
|
||||
this.onMessageListeners = onMessageListeners;
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +55,7 @@ export class Logger {
|
|||
);
|
||||
}
|
||||
|
||||
public addOnMessageListener(listener: (message: LogLine) => void): void {
|
||||
public addOnMessageListener(listener: (message: LogLine) => unknown): void {
|
||||
this.onMessageListeners.push(listener);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export class SyncHistory {
|
|||
|
||||
private readonly syncHistoryUpdateListeners: ((
|
||||
status: HistoryStats
|
||||
) => void)[] = [];
|
||||
) => unknown)[] = [];
|
||||
|
||||
private status: HistoryStats = {
|
||||
success: 0,
|
||||
|
|
@ -111,7 +111,7 @@ export class SyncHistory {
|
|||
}
|
||||
|
||||
public addSyncHistoryUpdateListener(
|
||||
listener: (stats: HistoryStats) => void
|
||||
listener: (stats: HistoryStats) => unknown
|
||||
): void {
|
||||
this.syncHistoryUpdateListeners.push(listener);
|
||||
listener({ ...this.status });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue