Major refactor into type safe TS

With a risk oof rolling it all back
This commit is contained in:
Janus C. H. Knudsen 2025-09-23 20:44:15 +02:00
parent c08fa02c29
commit 48d1fd681c
19 changed files with 449 additions and 81 deletions

View file

@ -59,14 +59,14 @@ export class EventBus implements IEventBus {
/**
* Emit an event via DOM CustomEvent
*/
emit(eventType: string, detail: any = {}): boolean {
emit(eventType: string, detail: unknown = {}): boolean {
// Validate eventType
if (!eventType || typeof eventType !== 'string') {
if (!eventType) {
return false;
}
const event = new CustomEvent(eventType, {
detail,
detail: detail ?? {},
bubbles: true,
cancelable: true
});
@ -78,7 +78,7 @@ export class EventBus implements IEventBus {
this.eventLog.push({
type: eventType,
detail,
detail: detail ?? {},
timestamp: Date.now()
});
@ -89,7 +89,7 @@ export class EventBus implements IEventBus {
/**
* Log event with console grouping
*/
private logEventWithGrouping(eventType: string, detail: any): void {
private logEventWithGrouping(eventType: string, detail: unknown): void {
// Extract category from event type (e.g., 'calendar:datechanged' → 'calendar')
const category = this.extractCategory(eventType);
@ -108,7 +108,7 @@ export class EventBus implements IEventBus {
* Extract category from event type
*/
private extractCategory(eventType: string): string {
if (!eventType || typeof eventType !== 'string') {
if (!eventType) {
return 'unknown';
}