tsc: fix builds & fix type errors
This commit is contained in:
+3
-2
@@ -4,6 +4,7 @@ import { proto } from '../../WAProto'
|
||||
import { DEFAULT_CACHE_TTLS, PROCESSABLE_HISTORY_TYPES } from '../Defaults'
|
||||
import type {
|
||||
BotListInfo,
|
||||
CacheStore,
|
||||
ChatModification,
|
||||
ChatMutation,
|
||||
LTHashState,
|
||||
@@ -73,10 +74,10 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
|
||||
const placeholderResendCache =
|
||||
config.placeholderResendCache ||
|
||||
new NodeCache({
|
||||
(new NodeCache<number>({
|
||||
stdTTL: DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
|
||||
useClones: false
|
||||
})
|
||||
}) as CacheStore)
|
||||
|
||||
if (!config.placeholderResendCache) {
|
||||
config.placeholderResendCache = placeholderResendCache
|
||||
|
||||
@@ -83,13 +83,13 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
|
||||
const msgRetryCache =
|
||||
config.msgRetryCounterCache ||
|
||||
new NodeCache({
|
||||
new NodeCache<number>({
|
||||
stdTTL: DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
|
||||
useClones: false
|
||||
})
|
||||
const callOfferCache =
|
||||
config.callOfferCache ||
|
||||
new NodeCache({
|
||||
new NodeCache<WACallEvent>({
|
||||
stdTTL: DEFAULT_CACHE_TTLS.CALL_OFFER, // 5 mins
|
||||
useClones: false
|
||||
})
|
||||
|
||||
@@ -75,7 +75,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
|
||||
const userDevicesCache =
|
||||
config.userDevicesCache ||
|
||||
new NodeCache({
|
||||
new NodeCache<JidWithDevice[]>({
|
||||
stdTTL: DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
|
||||
useClones: false
|
||||
})
|
||||
@@ -237,7 +237,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
for (const key in deviceMap) {
|
||||
userDevicesCache.set(key, deviceMap[key])
|
||||
userDevicesCache.set(key, deviceMap[key]!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export function makeCacheableSignalKeyStore(
|
||||
): SignalKeyStore {
|
||||
const cache =
|
||||
_cache ||
|
||||
new NodeCache({
|
||||
new NodeCache<SignalDataTypeMap[keyof SignalDataTypeMap]>({
|
||||
stdTTL: DEFAULT_CACHE_TTLS.SIGNAL_STORE, // 5 minutes
|
||||
useClones: false,
|
||||
deleteOnExpire: true
|
||||
@@ -42,7 +42,7 @@ export function makeCacheableSignalKeyStore(
|
||||
const data: { [_: string]: SignalDataTypeMap[typeof type] } = {}
|
||||
const idsToFetch: string[] = []
|
||||
for (const id of ids) {
|
||||
const item = cache.get<SignalDataTypeMap[typeof type]>(getUniqueId(type, id))
|
||||
const item = cache.get<SignalDataTypeMap[typeof type]>(getUniqueId(type, id)) as any
|
||||
if (typeof item !== 'undefined') {
|
||||
data[id] = item
|
||||
} else {
|
||||
@@ -68,7 +68,7 @@ export function makeCacheableSignalKeyStore(
|
||||
let keys = 0
|
||||
for (const type in data) {
|
||||
for (const id in data[type as keyof SignalDataTypeMap]) {
|
||||
cache.set(getUniqueId(type, id), data[type as keyof SignalDataTypeMap]![id])
|
||||
cache.set(getUniqueId(type, id), data[type as keyof SignalDataTypeMap]![id]!)
|
||||
keys += 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user