timeout Callabletimeout<Value, Error>(self, delay): Task<Value, TimeoutError | Error>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@exampleconst longTask = Time.delay(TimeDuration({ hours: 1 }));const timeoutTask = timeout(longTask, TimeDuration(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
taskis not resolved or rejected withindelayIf timeout is omitted, the task is returned unchanged