From c6912f5a92d0b3a263746bd0a88b6953e7d2aed8 Mon Sep 17 00:00:00 2001 From: JSC Date: Fri, 15 Aug 2025 00:02:20 +0200 Subject: [PATCH] refactor: change type from 'any' to 'unknown' in ApiResponse and EventHandler for better type safety --- src/lib/api/types.ts | 2 +- src/lib/events.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/api/types.ts b/src/lib/api/types.ts index 956e6d8..31d1ed7 100644 --- a/src/lib/api/types.ts +++ b/src/lib/api/types.ts @@ -1,5 +1,5 @@ // Generic API types -export interface ApiResponse { +export interface ApiResponse { data?: T message?: string error?: string diff --git a/src/lib/events.ts b/src/lib/events.ts index 075cec0..b946500 100644 --- a/src/lib/events.ts +++ b/src/lib/events.ts @@ -2,7 +2,7 @@ * Simple event emitter for cross-component communication */ -type EventHandler = (...args: any[]) => void +type EventHandler = (...args: unknown[]) => void class EventEmitter { private events: Map = new Map() @@ -24,7 +24,7 @@ class EventEmitter { } } - emit(event: string, ...args: any[]): void { + emit(event: string, ...args: unknown[]): void { const handlers = this.events.get(event) if (handlers) { handlers.forEach(handler => handler(...args))