Merge pull request #23284 from overleaf/ae-scope-event-types

Improve scope event types

GitOrigin-RevId: 5327c56a14244a2513748d3bcbac04413d104e12
This commit is contained in:
Alf Eaton
2025-02-05 09:04:58 +00:00
committed by Copybot
parent 4b1babd4ea
commit 797686939f
9 changed files with 68 additions and 52 deletions
@@ -3,13 +3,13 @@ import { IdeEvents } from '@/features/ide-react/create-ide-event-emitter'
export type ScopeEventName = keyof IdeEvents
export interface ScopeEventEmitter {
emit: (
eventName: ScopeEventName,
emit: <T extends ScopeEventName>(
eventName: T,
broadcast: boolean,
...detail: unknown[]
...detail: IdeEvents[T]
) => void
on: (
eventName: ScopeEventName,
listener: (...args: unknown[]) => void
on: <T extends ScopeEventName>(
eventName: T,
listener: (event: Event, ...args: IdeEvents[T]) => void
) => () => void
}