docs: refine code comment
[poolifier.git] / src / worker / task-functions.ts
index a61d69627ce6eeebd36e462f5801c36e94cc8e06..5518043eb022857209401a32ecd0a0a9d18bcf30 100644 (file)
@@ -1,6 +1,9 @@
 /**
  * Task synchronous function that can be executed.
  *
+ * @param data - Data sent to the worker.
+ * @returns Execution response.
+ *
  * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
  * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
  */
@@ -12,6 +15,9 @@ export type TaskSyncFunction<Data = unknown, Response = unknown> = (
  * Task asynchronous function that can be executed.
  * This function must return a promise.
  *
+ * @param data - Data sent to the worker.
+ * @returns Execution response promise.
+ *
  * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data.
  * @typeParam Response - Type of execution response. This can only be structured-cloneable data.
  */
@@ -43,3 +49,11 @@ export type TaskFunctions<Data = unknown, Response = unknown> = Record<
 string,
 TaskFunction<Data, Response>
 >
+
+/**
+ * Task function operation result.
+ */
+export interface TaskFunctionOperationResult {
+  status: boolean
+  error?: Error
+}