Skip to main content

Class: Value<T>

Defined in: packages/fast-check/src/check/arbitrary/definition/Value.ts:13

A Value<T, TShrink = T> holds an internal value of type T and its associated context

Remarks

Since 3.0.0 (previously called NextValue in 2.15.0)

Type Parameters

Type Parameter
T

Constructors

Constructor

new Value<T>(value_, context, customGetValue?): Value<T>

Defined in: packages/fast-check/src/check/arbitrary/definition/Value.ts:50

Parameters

ParameterTypeDefault valueDescription
value_TundefinedInternal value of the shrinkable
contextunknownundefinedContext associated to the generated value (useful for shrink)
customGetValue(() => T) | undefinedundefinedLimited to internal usages (to ease migration to next), it will be removed on next major

Returns

Value<T>

Properties

context

readonly context: unknown

Defined in: packages/fast-check/src/check/arbitrary/definition/Value.ts:43

Context for the generated value TODO - Do we want to clone it too?

Remarks

2.15.0


hasToBeCloned

readonly hasToBeCloned: boolean

Defined in: packages/fast-check/src/check/arbitrary/definition/Value.ts:19

State storing the result of hasCloneMethod If true the value will be cloned each time it gets accessed

Remarks

Since 2.15.0


value

readonly value: T

Defined in: packages/fast-check/src/check/arbitrary/definition/Value.ts:32

Safe value of the shrinkable Depending on hasToBeCloned it will either be value_ or a clone of it

Remarks

Since 2.15.0


value_

readonly value_: T

Defined in: packages/fast-check/src/check/arbitrary/definition/Value.ts:37

Internal value of the shrinkable

Remarks

Since 2.15.0