Use unknown return type for callbacks

This commit is contained in:
Andras Schmelczer 2025-08-17 15:12:31 +01:00
parent e73f147fbc
commit 81b81e30ff
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
16 changed files with 95 additions and 76 deletions

View file

@ -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);
}

View file

@ -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 });