refactor: change type from 'any' to 'unknown' in ApiResponse and EventHandler for better type safety
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Generic API types
|
||||
export interface ApiResponse<T = any> {
|
||||
export interface ApiResponse<T = unknown> {
|
||||
data?: T
|
||||
message?: string
|
||||
error?: string
|
||||
|
||||
@@ -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<string, EventHandler[]> = 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))
|
||||
|
||||
Reference in New Issue
Block a user