Creates a task that will reject a TimeoutError if task is not resolved or rejected within delay
If timeout is omitted, the task is returned unchanged
@example
const longTask = Task.delay(TimeDuration.hours(1)); const timeoutTask =timeout(longTask, TimeDuration.milliseconds(4)); Task.run(timeoutTask);// Result.Error(TimeoutError({ message: 'Task timed out after 4ms', delay: 4 })) // Note that `longTask` will be canceled and will never resolve nor reject
Creates a task that will reject a TimeoutError if
task
is not resolved or rejected withindelay
If timeout is omitted, the task is returned unchanged