Get the first event of a specific type
(
type: T,
)
| 53 | |
| 54 | /** Get the first event of a specific type */ |
| 55 | getFirstEvent<T extends PrintModeEvent['type']>( |
| 56 | type: T, |
| 57 | ): Extract<PrintModeEvent, { type: T }> | undefined { |
| 58 | return this.events.find( |
| 59 | (e): e is Extract<PrintModeEvent, { type: T }> => e.type === type, |
| 60 | ) |
| 61 | } |
| 62 | |
| 63 | /** Get the last event of a specific type */ |
| 64 | getLastEvent<T extends PrintModeEvent['type']>( |
no outgoing calls
no test coverage detected