- Updated the function in to safely handle potential undefined values in . - Modified the hook to correctly type the event emitter, enhancing type safety and clarity. - Adjusted the to support a new type for better event handling.