UNPKG

1.23 kBTypeScriptView Raw
1/**
2 * A `Value<T, TShrink = T>` holds an internal value of type `T`
3 * and its associated context
4 *
5 * @remarks Since 3.0.0 (previously called `NextValue` in 2.15.0)
6 * @public
7 */
8export declare class Value<T> {
9 /**
10 * State storing the result of hasCloneMethod
11 * If `true` the value will be cloned each time it gets accessed
12 * @remarks Since 2.15.0
13 */
14 readonly hasToBeCloned: boolean;
15 /**
16 * Safe value of the shrinkable
17 * Depending on `hasToBeCloned` it will either be `value_` or a clone of it
18 * @remarks Since 2.15.0
19 */
20 readonly value: T;
21 /**
22 * Internal value of the shrinkable
23 * @remarks Since 2.15.0
24 */
25 readonly value_: T;
26 /**
27 * Context for the generated value
28 * TODO - Do we want to clone it too?
29 * @remarks 2.15.0
30 */
31 readonly context: unknown;
32 /**
33 * @param value_ - Internal value of the shrinkable
34 * @param context - Context associated to the generated value (useful for shrink)
35 * @param customGetValue - Limited to internal usages (to ease migration to next), it will be removed on next major
36 */
37 constructor(value_: T, context: unknown, customGetValue?: (() => T) | undefined);
38}