fix(utils): resolve TypeScript compilation errors

- baileys-event-stream.ts: Add null check for buffer item in priority insertion
- baileys-logger.ts: Handle 'silent' log level and fix JID sanitization
- cache-utils.ts: Fix type incompatibility in global cache with any type
- logger-adapter.ts: Add nullish coalescing for level mapping and fix console type cast
- prometheus-metrics.ts: Rename private 'metrics' property to 'metricsMap' to avoid conflict with method
- trace-context.ts: Store baggage header in variable before accessing to fix undefined check
This commit is contained in:
Claude
2026-01-20 02:05:14 +00:00
parent a934be9bc9
commit dd59a7fe65
6 changed files with 35 additions and 19 deletions
+3 -2
View File
@@ -500,11 +500,12 @@ export function withCache<T extends (...args: unknown[]) => unknown>(
/**
* Global singleton cache by namespace
*/
const globalCaches: Map<string, Cache<unknown>> = new Map()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const globalCaches: Map<string, Cache<any>> = new Map()
export function getGlobalCache<V>(namespace: string, options?: CacheOptions<V>): Cache<V> {
if (!globalCaches.has(namespace)) {
globalCaches.set(namespace, new Cache<V>({ ...options, namespace }))
globalCaches.set(namespace, new Cache<V>({ ...options, namespace }) as Cache<V>)
}
return globalCaches.get(namespace) as Cache<V>
}