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

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?

2.15.0

hasToBeCloned: boolean

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

Since 2.15.0

value: T

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

Since 2.15.0

value_: T

Internal value of the shrinkable

Since 2.15.0