# WRNexusJS 0.7.0 R4 — Happy DOM Event Type Correction ## Problem `packages/validation/test/validation.test.ts` returned the browser DOM `Event` type from its synthetic event helper. Happy DOM elements require Happy DOM's own event class, so strict TypeScript reported two incompatible `dispatchEvent()` calls. ## Fix The helper now derives its event type directly from Happy DOM's own `document.dispatchEvent` parameter: ```ts type HappyDOMEvent = Parameters[0]; type HappyDOMEventConstructor = new (type: string, init?: EventInit) => HappyDOMEvent; function windowEvent(win: Window, type: string, init?: EventInit): HappyDOMEvent { const EventConstructor = (win as unknown as { Event: HappyDOMEventConstructor }).Event; return new EventConstructor(type, init); } ``` This keeps browser DOM tests and Happy DOM tests type-safe without using an unsafe browser `Event` return type. ## Workspace repair The two `.env` files and temporary focused-typecheck files shown by `check:workspace` are local leftovers. Run `bun run repair:workspace` once before the security audit. The command preserves local `.env` contents while removing unsafe files from Git tracking. ## Additional improvement `check:workspace` now says `would remove` in check mode, instead of incorrectly implying files were already removed.