- response = this.addTaskFunction(
- taskFunctionName,
- // eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
- new Function(`return ${taskFunction}`)() as TaskFunction<
- Data,
- Response
- >
- )
+ response = this.addTaskFunction(taskFunctionProperties.name, {
+ // eslint-disable-next-line no-new-func
+ taskFunction: new Function(
+ `return ${taskFunction}`
+ )() as TaskFunction<Data, Response>,
+ ...(taskFunctionProperties.priority != null && {
+ priority: taskFunctionProperties.priority,
+ }),
+ ...(taskFunctionProperties.strategy != null && {
+ strategy: taskFunctionProperties.strategy,
+ }),
+ })