-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
30 lines (25 loc) · 878 Bytes
/
types.ts
File metadata and controls
30 lines (25 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @file Public type surface for `events/exit/*` modules — the `OnExitOptions`
* consumed by `onExit`, plus the shared internal types for the signal
* emitter, emitted-signal map, and listener map. Pure types, no runtime side
* effects.
*/
import type { EventEmitter } from 'node:events'
// Type for tracking emitted signals.
export type EmittedSignals = {
// Using string as signals can include custom events like 'exit' and 'afterexit'.
[signal: string]: boolean
}
export type SignalExitEmitter = EventEmitter & {
count?: number | undefined
emitted?: EmittedSignals | undefined
infinite?: boolean | undefined
}
export type SignalListener = () => void
// Type for signal listeners indexed by signal name.
export type SignalListenerMap = {
[signal: string]: SignalListener
}
export interface OnExitOptions {
alwaysLast?: boolean | undefined
}