lint: 0 warnings left

This commit is contained in:
Rajeh Taher
2024-10-14 05:15:10 +03:00
parent 61a0ff3178
commit 18ac07df8e
32 changed files with 652 additions and 1006 deletions

View File

@@ -42,6 +42,7 @@ type BaileysBufferableEventEmitter = BaileysEventEmitter & {
* */
buffer(): void
/** buffers all events till the promise completes */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>)
/**
* flushes all buffered events
@@ -132,7 +133,7 @@ export const makeEventBuffer = (logger: Logger): BaileysBufferableEventEmitter =
},
emit<T extends BaileysEvent>(event: BaileysEvent, evData: BaileysEventMap[T]) {
if(buffersInProgress && BUFFERABLE_EVENT_SET.has(event)) {
append(data, historyCache, event as any, evData, logger)
append(data, historyCache, event as BufferableEvent, evData, logger)
return true
}
@@ -187,6 +188,7 @@ function append<E extends BufferableEvent>(
data: BufferedEventData,
historyCache: Set<string>,
event: E,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
eventData: any,
logger: Logger
) {
@@ -331,7 +333,7 @@ function append<E extends BufferableEvent>(
}
if(data.contactUpdates[contact.id]) {
upsert = Object.assign(data.contactUpdates[contact.id], trimUndefined(contact))
upsert = Object.assign(data.contactUpdates[contact.id], trimUndefined(contact)) as Contact
delete data.contactUpdates[contact.id]
}
}
@@ -598,12 +600,10 @@ function consolidateEvents(data: BufferedEventData) {
}
function concatChats<C extends Partial<Chat>>(a: C, b: Partial<Chat>) {
if(b.unreadCount === null) {
// neutralize unread counter
if(a.unreadCount! < 0) {
a.unreadCount = undefined
b.unreadCount = undefined
}
if(b.unreadCount === null && // neutralize unread counter
a.unreadCount! < 0) {
a.unreadCount = undefined
b.unreadCount = undefined
}
if(typeof a.unreadCount === 'number' && typeof b.unreadCount === 'number') {