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

  • T

Constructors

  • Type Parameters

    • T

    Parameters

    • value_: T

      Internal value of the shrinkable

    • context: unknown

      Context associated to the generated value (useful for shrink)

    • customGetValue: undefined | (() => T) = undefined

      Limited to internal usages (to ease migration to next), it will be removed on next major

    Returns Value<T>

Properties

context: unknown

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

Remarks

2.15.0

hasToBeCloned: boolean

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

Remarks

Since 2.15.0

readOnce: boolean

Flag indicating whether or not the this.value has already been called once If so, the underlying will be cloned Only set when hasToBeCloned = true

value: T

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

Remarks

Since 2.15.0

value_: T

Internal value of the shrinkable

Remarks

Since 2.15.0

Methods