1 import type { Worker
} from
'cluster'
2 import type { MessagePort
} from
'worker_threads'
3 import type { KillBehavior
} from
'./worker/worker-options'
6 * Make all properties in T non-readonly.
8 export type Draft
<T
> = { -readonly [P
in keyof T
]?: T
[P
] }
11 * Serializable primitive JSON value.
13 export type JSONPrimitive
= number | boolean | string | null
15 * Serializable JSON value.
17 // eslint-disable-next-line no-use-before-define
18 export type JSONValue
= JSONPrimitive
| JSONArray
| JSONObject
20 * Serializable JSON object.
22 export type JSONObject
= { [k
: string]: JSONValue
}
24 * Serializable JSON array.
26 export type JSONArray
= Array<JSONValue
>
29 * Message object that is passed between worker and main worker.
31 export interface MessageValue
<
33 MainWorker
extends Worker
| MessagePort
| unknown
= unknown
36 * Input data that will be passed to the worker.
46 readonly kill
?: KillBehavior
| 1
50 readonly error
?: string
52 * Reference to main worker.
54 * _Only for internal use_
56 readonly parent?: MainWorker