OptionaloverriddenAn overridden duration for the task function, to be used instead of the duration measured by tinybench when running the benchmark.
This can be useful to measure parts of the execution of a function that are hard to execute independently.
OptionaloverriddenThe declared duration of the whole task function call, in milliseconds,
consumed by the sequential time and warmupTime budgets. If absent or
invalid, the budget uses the sample before timer-overhead correction.
Must be finite and non-negative (0 and -0 included). Own and inherited
properties are supported; presence-check and access errors are treated
as absence. Repeated zero costs cannot satisfy a positive time budget.
Applies per task with concurrency: 'bench' and in
Task.warmupSync regardless of concurrency. Task-concurrent run()
and warmup() use the clock and do not inspect this field: neither its
presence nor its value is read. Does not affect samples, timer-overhead
correction or timer diagnostics.
A possible object returned by task functions to override default behaviors, like the duration of the function itself. Annotate a callback return as this type (
Promise<FnReturnedObject>for async callbacks), or usesatisfies FnReturnedObjecton the returned object to check measurement fields. Annotating the callback as Fn alone does not check them. Numeric values are still validated at runtime.