1 import type { Worker
} from
'cluster'
2 import type { MessagePort
} from
'worker_threads'
5 * Make all properties in T non-readonly
7 export type Draft
<T
> = { -readonly [P
in keyof T
]?: T
[P
] }
10 * Serializable primitive JSON value.
12 export type JSONPrimitive
= number | boolean | string | null
14 * Serializable JSON value.
16 // eslint-disable-next-line no-use-before-define
17 export type JSONValue
= JSONPrimitive
| JSONArray
| JSONObject
19 * Serializable JSON object.
21 export type JSONObject
= { [k
: string]: JSONValue
}
23 * Serializable JSON array.
25 export type JSONArray
= Array<JSONValue
>
28 * Message object that is passed between worker and main worker.
30 export interface MessageValue
<
32 MainWorker
extends Worker
| MessagePort
| unknown
= unknown
35 * Input data that will be passed to the worker.
45 readonly kill
?: number
49 readonly error
?: string
51 * Reference to main worker.
53 * _Only for internal use_
55 readonly parent?: MainWorker