@depup/fast-check 4.6.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4796 @@
1
+ import { RandomGenerator as RandomGenerator$1 } from "pure-rand/types/RandomGenerator";
2
+ import { JumpableRandomGenerator } from "pure-rand/types/JumpableRandomGenerator";
3
+
4
+ //#region src/check/precondition/Pre.d.ts
5
+ /**
6
+ * Add pre-condition checks inside a property execution
7
+ * @param expectTruthy - cancel the run whenever this value is falsy
8
+ * @remarks Since 1.3.0
9
+ * @public
10
+ */
11
+ declare function pre(expectTruthy: boolean): asserts expectTruthy;
12
+ //#endregion
13
+ //#region src/random/generator/RandomGenerator.d.ts
14
+ interface RandomGenerator7x {
15
+ clone(): RandomGenerator7x;
16
+ next(): [number, RandomGenerator7x];
17
+ jump?(): RandomGenerator7x;
18
+ unsafeNext(): number;
19
+ unsafeJump?(): void;
20
+ getState(): readonly number[];
21
+ }
22
+ /**
23
+ * Merged type supporting both pure-rand v7 and v8 random generators.
24
+ * Keeping compatibility with v7 avoids a breaking API change and a new major version.
25
+ * @remarks Since 4.6.0
26
+ * @public
27
+ */
28
+ type RandomGenerator = RandomGenerator7x | RandomGenerator$1 | JumpableRandomGenerator;
29
+ //#endregion
30
+ //#region src/random/generator/Random.d.ts
31
+ /**
32
+ * Wrapper around an instance of a `pure-rand`'s random number generator
33
+ * offering a simpler interface to deal with random with impure patterns
34
+ *
35
+ * @public
36
+ */
37
+ declare class Random {
38
+ /**
39
+ * Create a mutable random number generator by cloning the passed one and mutate it
40
+ * @param sourceRng - Immutable random generator from pure-rand library, will not be altered (a clone will be)
41
+ */
42
+ constructor(sourceRng: RandomGenerator);
43
+ /**
44
+ * Clone the random number generator
45
+ */
46
+ clone(): Random;
47
+ /**
48
+ * Generate an integer having `bits` random bits
49
+ * @param bits - Number of bits to generate
50
+ * @deprecated Prefer {@link nextInt} with explicit bounds: `nextInt(0, (1 << bits) - 1)`
51
+ */
52
+ next(bits: number): number;
53
+ /**
54
+ * Generate a random boolean
55
+ */
56
+ nextBoolean(): boolean;
57
+ /**
58
+ * Generate a random integer (32 bits)
59
+ * @deprecated Prefer {@link nextInt} with explicit bounds: `nextInt(-2147483648, 2147483647)`
60
+ */
61
+ nextInt(): number;
62
+ /**
63
+ * Generate a random integer between min (included) and max (included)
64
+ * @param min - Minimal integer value
65
+ * @param max - Maximal integer value
66
+ */
67
+ nextInt(min: number, max: number): number;
68
+ /**
69
+ * Generate a random bigint between min (included) and max (included)
70
+ * @param min - Minimal bigint value
71
+ * @param max - Maximal bigint value
72
+ */
73
+ nextBigInt(min: bigint, max: bigint): bigint;
74
+ /**
75
+ * Generate a random floating point number between 0.0 (included) and 1.0 (excluded)
76
+ */
77
+ nextDouble(): number;
78
+ /**
79
+ * Extract the internal state of the internal RandomGenerator backing the current instance of Random
80
+ */
81
+ getState(): readonly number[] | undefined;
82
+ }
83
+ //#endregion
84
+ //#region src/stream/Stream.d.ts
85
+ /**
86
+ * Wrapper around `IterableIterator` interface
87
+ * offering a set of helpers to deal with iterations in a simple way
88
+ *
89
+ * @remarks Since 0.0.7
90
+ * @public
91
+ */
92
+ declare class Stream<T> implements IterableIterator<T> {
93
+ /** @internal */
94
+ private readonly g;
95
+ /**
96
+ * Create an empty stream of T
97
+ * @remarks Since 0.0.1
98
+ */
99
+ static nil<T>(): Stream<T>;
100
+ /**
101
+ * Create a stream of T from a variable number of elements
102
+ *
103
+ * @param elements - Elements used to create the Stream
104
+ * @remarks Since 2.12.0
105
+ */
106
+ static of<T>(...elements: T[]): Stream<T>;
107
+ /**
108
+ * Create a Stream based on `g`
109
+ * @param g - Underlying data of the Stream
110
+ */
111
+ constructor(g: IterableIterator<T>);
112
+ next(): IteratorResult<T>;
113
+ [Symbol.iterator](): IterableIterator<T>;
114
+ /**
115
+ * Map all elements of the Stream using `f`
116
+ *
117
+ * WARNING: It closes the current stream
118
+ *
119
+ * @param f - Mapper function
120
+ * @remarks Since 0.0.1
121
+ */
122
+ map<U>(f: (v: T) => U): Stream<U>;
123
+ /**
124
+ * Flat map all elements of the Stream using `f`
125
+ *
126
+ * WARNING: It closes the current stream
127
+ *
128
+ * @param f - Mapper function
129
+ * @remarks Since 0.0.1
130
+ */
131
+ flatMap<U>(f: (v: T) => IterableIterator<U>): Stream<U>;
132
+ /**
133
+ * Drop elements from the Stream while `f(element) === true`
134
+ *
135
+ * WARNING: It closes the current stream
136
+ *
137
+ * @param f - Drop condition
138
+ * @remarks Since 0.0.1
139
+ */
140
+ dropWhile(f: (v: T) => boolean): Stream<T>;
141
+ /**
142
+ * Drop `n` first elements of the Stream
143
+ *
144
+ * WARNING: It closes the current stream
145
+ *
146
+ * @param n - Number of elements to drop
147
+ * @remarks Since 0.0.1
148
+ */
149
+ drop(n: number): Stream<T>;
150
+ /**
151
+ * Take elements from the Stream while `f(element) === true`
152
+ *
153
+ * WARNING: It closes the current stream
154
+ *
155
+ * @param f - Take condition
156
+ * @remarks Since 0.0.1
157
+ */
158
+ takeWhile(f: (v: T) => boolean): Stream<T>;
159
+ /**
160
+ * Take `n` first elements of the Stream
161
+ *
162
+ * WARNING: It closes the current stream
163
+ *
164
+ * @param n - Number of elements to take
165
+ * @remarks Since 0.0.1
166
+ */
167
+ take(n: number): Stream<T>;
168
+ /**
169
+ * Filter elements of the Stream
170
+ *
171
+ * WARNING: It closes the current stream
172
+ *
173
+ * @param f - Elements to keep
174
+ * @remarks Since 1.23.0
175
+ */
176
+ filter<U extends T>(f: (v: T) => v is U): Stream<U>;
177
+ /**
178
+ * Filter elements of the Stream
179
+ *
180
+ * WARNING: It closes the current stream
181
+ *
182
+ * @param f - Elements to keep
183
+ * @remarks Since 0.0.1
184
+ */
185
+ filter(f: (v: T) => boolean): Stream<T>;
186
+ /**
187
+ * Check whether all elements of the Stream are successful for `f`
188
+ *
189
+ * WARNING: It closes the current stream
190
+ *
191
+ * @param f - Condition to check
192
+ * @remarks Since 0.0.1
193
+ */
194
+ every(f: (v: T) => boolean): boolean;
195
+ /**
196
+ * Check whether one of the elements of the Stream is successful for `f`
197
+ *
198
+ * WARNING: It closes the current stream
199
+ *
200
+ * @param f - Condition to check
201
+ * @remarks Since 0.0.1
202
+ */
203
+ has(f: (v: T) => boolean): [boolean, T | null];
204
+ /**
205
+ * Join `others` Stream to the current Stream
206
+ *
207
+ * WARNING: It closes the current stream and the other ones (as soon as it iterates over them)
208
+ *
209
+ * @param others - Streams to join to the current Stream
210
+ * @remarks Since 0.0.1
211
+ */
212
+ join(...others: IterableIterator<T>[]): Stream<T>;
213
+ /**
214
+ * Take the `nth` element of the Stream of the last (if it does not exist)
215
+ *
216
+ * WARNING: It closes the current stream
217
+ *
218
+ * @param nth - Position of the element to extract
219
+ * @remarks Since 0.0.12
220
+ */
221
+ getNthOrLast(nth: number): T | null;
222
+ }
223
+ /**
224
+ * Create a Stream based on `g`
225
+ *
226
+ * @param g - Underlying data of the Stream
227
+ *
228
+ * @remarks Since 0.0.7
229
+ * @public
230
+ */
231
+ declare function stream<T>(g: IterableIterator<T>): Stream<T>;
232
+ //#endregion
233
+ //#region src/check/arbitrary/definition/Value.d.ts
234
+ /**
235
+ * A `Value<T, TShrink = T>` holds an internal value of type `T`
236
+ * and its associated context
237
+ *
238
+ * @remarks Since 3.0.0 (previously called `NextValue` in 2.15.0)
239
+ * @public
240
+ */
241
+ declare class Value<T> {
242
+ /**
243
+ * State storing the result of hasCloneMethod
244
+ * If `true` the value will be cloned each time it gets accessed
245
+ * @remarks Since 2.15.0
246
+ */
247
+ readonly hasToBeCloned: boolean;
248
+ /**
249
+ * Safe value of the shrinkable
250
+ * Depending on `hasToBeCloned` it will either be `value_` or a clone of it
251
+ * @remarks Since 2.15.0
252
+ */
253
+ readonly value: T;
254
+ /**
255
+ * Internal value of the shrinkable
256
+ * @remarks Since 2.15.0
257
+ */
258
+ readonly value_: T;
259
+ /**
260
+ * Context for the generated value
261
+ * TODO - Do we want to clone it too?
262
+ * @remarks 2.15.0
263
+ */
264
+ readonly context: unknown;
265
+ /**
266
+ * @param value_ - Internal value of the shrinkable
267
+ * @param context - Context associated to the generated value (useful for shrink)
268
+ * @param customGetValue - Limited to internal usages (to ease migration to next), it will be removed on next major
269
+ */
270
+ constructor(value_: T, context: unknown, customGetValue?: (() => T) | undefined);
271
+ }
272
+ //#endregion
273
+ //#region src/check/arbitrary/definition/Arbitrary.d.ts
274
+ /**
275
+ * Abstract class able to generate values on type `T`
276
+ *
277
+ * The values generated by an instance of Arbitrary can be previewed - with {@link sample} - or classified - with {@link statistics}.
278
+ *
279
+ * @remarks Since 0.0.7
280
+ * @public
281
+ */
282
+ declare abstract class Arbitrary<T> {
283
+ /**
284
+ * Generate a value of type `T` along with its context (if any)
285
+ * based on the provided random number generator
286
+ *
287
+ * @param mrng - Random number generator
288
+ * @param biasFactor - If taken into account 1 value over biasFactor must be biased. Either integer value greater or equal to 2 (bias) or undefined (no bias)
289
+ * @returns Random value of type `T` and its context
290
+ *
291
+ * @remarks Since 0.0.1 (return type changed in 3.0.0)
292
+ */
293
+ abstract generate(mrng: Random, biasFactor: number | undefined): Value<T>;
294
+ /**
295
+ * Check if a given value could be pass to `shrink` without providing any context.
296
+ *
297
+ * In general, `canShrinkWithoutContext` is not designed to be called for each `shrink` but rather on very special cases.
298
+ * Its usage must be restricted to `canShrinkWithoutContext` or in the rare* contexts of a `shrink` method being called without
299
+ * any context. In this ill-formed case of `shrink`, `canShrinkWithoutContext` could be used or called if needed.
300
+ *
301
+ * *we fall in that case when fast-check is asked to shrink a value that has been provided manually by the user,
302
+ * in other words: a value not coming from a call to `generate` or a normal `shrink` with context.
303
+ *
304
+ * @param value - Value to be assessed
305
+ * @returns `true` if and only if the value could have been generated by this instance
306
+ *
307
+ * @remarks Since 3.0.0
308
+ */
309
+ abstract canShrinkWithoutContext(value: unknown): value is T;
310
+ /**
311
+ * Shrink a value of type `T`, may rely on the context previously provided to shrink efficiently
312
+ *
313
+ * Must never be called with possibly invalid values and no context without ensuring that such call is legal
314
+ * by calling `canShrinkWithoutContext` first on the value.
315
+ *
316
+ * @param value - The value to shrink
317
+ * @param context - Its associated context (the one returned by generate) or `undefined` if no context but `canShrinkWithoutContext(value) === true`
318
+ * @returns Stream of shrinks for value based on context (if provided)
319
+ *
320
+ * @remarks Since 3.0.0
321
+ */
322
+ abstract shrink(value: T, context: unknown | undefined): Stream<Value<T>>;
323
+ /**
324
+ * Create another arbitrary by filtering values against `predicate`
325
+ *
326
+ * All the values produced by the resulting arbitrary
327
+ * satisfy `predicate(value) == true`
328
+ *
329
+ * Be aware that using filter may highly impact the time required to generate a valid entry
330
+ *
331
+ * @example
332
+ * ```typescript
333
+ * const integerGenerator: Arbitrary<number> = ...;
334
+ * const evenIntegerGenerator: Arbitrary<number> = integerGenerator.filter(e => e % 2 === 0);
335
+ * // new Arbitrary only keeps even values
336
+ * ```
337
+ *
338
+ * @param refinement - Predicate, to test each produced element. Return true to keep the element, false otherwise
339
+ * @returns New arbitrary filtered using predicate
340
+ *
341
+ * @remarks Since 1.23.0
342
+ */
343
+ filter<U extends T>(refinement: (t: T) => t is U): Arbitrary<U>;
344
+ /**
345
+ * Create another arbitrary by filtering values against `predicate`
346
+ *
347
+ * All the values produced by the resulting arbitrary
348
+ * satisfy `predicate(value) == true`
349
+ *
350
+ * Be aware that using filter may highly impact the time required to generate a valid entry
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * const integerGenerator: Arbitrary<number> = ...;
355
+ * const evenIntegerGenerator: Arbitrary<number> = integerGenerator.filter(e => e % 2 === 0);
356
+ * // new Arbitrary only keeps even values
357
+ * ```
358
+ *
359
+ * @param predicate - Predicate, to test each produced element. Return true to keep the element, false otherwise
360
+ * @returns New arbitrary filtered using predicate
361
+ *
362
+ * @remarks Since 0.0.1
363
+ */
364
+ filter(predicate: (t: T) => boolean): Arbitrary<T>;
365
+ /**
366
+ * Create another arbitrary by mapping all produced values using the provided `mapper`
367
+ * Values produced by the new arbitrary are the result of applying `mapper` value by value
368
+ *
369
+ * @example
370
+ * ```typescript
371
+ * const rgbChannels: Arbitrary<{r:number,g:number,b:number}> = ...;
372
+ * const color: Arbitrary<string> = rgbChannels.map(ch => `#${(ch.r*65536 + ch.g*256 + ch.b).toString(16).padStart(6, '0')}`);
373
+ * // transform an Arbitrary producing {r,g,b} integers into an Arbitrary of '#rrggbb'
374
+ * ```
375
+ *
376
+ * @param mapper - Map function, to produce a new element based on an old one
377
+ * @param unmapper - Optional unmap function, it will never be used except when shrinking user defined values. Must throw if value is not compatible (since 3.0.0)
378
+ * @returns New arbitrary with mapped elements
379
+ *
380
+ * @remarks Since 0.0.1
381
+ */
382
+ map<U>(mapper: (t: T) => U, unmapper?: (possiblyU: unknown) => T): Arbitrary<U>;
383
+ /**
384
+ * Create another arbitrary by mapping a value from a base Arbirary using the provided `fmapper`
385
+ * Values produced by the new arbitrary are the result of the arbitrary generated by applying `fmapper` to a value
386
+ * @example
387
+ * ```typescript
388
+ * const arrayAndLimitArbitrary = fc.nat().chain((c: number) => fc.tuple( fc.array(fc.nat(c)), fc.constant(c)));
389
+ * ```
390
+ *
391
+ * @param chainer - Chain function, to produce a new Arbitrary using a value from another Arbitrary
392
+ * @returns New arbitrary of new type
393
+ *
394
+ * @remarks Since 1.2.0
395
+ */
396
+ chain<U>(chainer: (t: T) => Arbitrary<U>): Arbitrary<U>;
397
+ }
398
+ //#endregion
399
+ //#region src/check/precondition/PreconditionFailure.d.ts
400
+ /**
401
+ * Error type produced whenever a precondition fails
402
+ * @remarks Since 2.2.0
403
+ * @public
404
+ */
405
+ declare class PreconditionFailure extends Error {
406
+ readonly interruptExecution: boolean;
407
+ constructor(interruptExecution?: boolean);
408
+ static isFailure(err: unknown): err is PreconditionFailure;
409
+ }
410
+ //#endregion
411
+ //#region src/check/property/IRawProperty.d.ts
412
+ /**
413
+ * Represent failures of the property
414
+ * @remarks Since 3.0.0
415
+ * @public
416
+ */
417
+ type PropertyFailure = {
418
+ /**
419
+ * The original error that has been intercepted.
420
+ * Possibly not an instance Error as users can throw anything.
421
+ * @remarks Since 3.0.0
422
+ */
423
+ error: unknown;
424
+ };
425
+ /**
426
+ * Property
427
+ *
428
+ * A property is the combination of:
429
+ * - Arbitraries: how to generate the inputs for the algorithm
430
+ * - Predicate: how to confirm the algorithm succeeded?
431
+ *
432
+ * @remarks Since 1.19.0
433
+ * @public
434
+ */
435
+ interface IRawProperty<Ts, IsAsync extends boolean = boolean> {
436
+ /**
437
+ * Is the property asynchronous?
438
+ *
439
+ * true in case of asynchronous property, false otherwise
440
+ * @remarks Since 0.0.7
441
+ */
442
+ isAsync(): IsAsync;
443
+ /**
444
+ * Generate values of type Ts
445
+ *
446
+ * @param mrng - Random number generator
447
+ * @param runId - Id of the generation, starting at 0 - if set the generation might be biased
448
+ *
449
+ * @remarks Since 0.0.7 (return type changed in 3.0.0)
450
+ */
451
+ generate(mrng: Random, runId?: number): Value<Ts>;
452
+ /**
453
+ * Shrink value of type Ts
454
+ *
455
+ * @param value - The value to be shrunk, it can be context-less
456
+ *
457
+ * @remarks Since 3.0.0
458
+ */
459
+ shrink(value: Value<Ts>): Stream<Value<Ts>>;
460
+ /**
461
+ * Check the predicate for v
462
+ * @param v - Value of which we want to check the predicate
463
+ * @remarks Since 0.0.7
464
+ */
465
+ run(v: Ts): (IsAsync extends true ? Promise<PreconditionFailure | PropertyFailure | null> : never) | (IsAsync extends false ? PreconditionFailure | PropertyFailure | null : never);
466
+ /**
467
+ * Run before each hook
468
+ * @remarks Since 3.4.0
469
+ */
470
+ runBeforeEach: () => (IsAsync extends true ? Promise<void> : never) | (IsAsync extends false ? void : never);
471
+ /**
472
+ * Run after each hook
473
+ * @remarks Since 3.4.0
474
+ */
475
+ runAfterEach: () => (IsAsync extends true ? Promise<void> : never) | (IsAsync extends false ? void : never);
476
+ }
477
+ //#endregion
478
+ //#region src/arbitrary/_internals/helpers/MaxLengthFromMinLength.d.ts
479
+ /**
480
+ * The size parameter defines how large the generated values could be.
481
+ *
482
+ * The default in fast-check is 'small' but it could be increased (resp. decreased)
483
+ * to ask arbitraries for larger (resp. smaller) values.
484
+ *
485
+ * @remarks Since 2.22.0
486
+ * @public
487
+ */
488
+ type Size = "xsmall" | "small" | "medium" | "large" | "xlarge";
489
+ /**
490
+ * @remarks Since 2.22.0
491
+ * @public
492
+ */
493
+ type RelativeSize = "-4" | "-3" | "-2" | "-1" | "=" | "+1" | "+2" | "+3" | "+4";
494
+ /**
495
+ * Superset of {@link Size} to override the default defined for size
496
+ * @remarks Since 2.22.0
497
+ * @public
498
+ */
499
+ type SizeForArbitrary = RelativeSize | Size | "max" | undefined;
500
+ /**
501
+ * Superset of {@link Size} to override the default defined for size.
502
+ * It can either be based on a numeric value manually selected by the user (not recommended)
503
+ * or rely on presets based on size (recommended).
504
+ *
505
+ * This size will be used to infer a bias to limit the depth, used as follow within recursive structures:
506
+ * While going deeper, the bias on depth will increase the probability to generate small instances.
507
+ *
508
+ * When used with {@link Size}, the larger the size the deeper the structure.
509
+ * When used with numeric values, the larger the number (floating point number &gt;= 0),
510
+ * the deeper the structure. `+0` means extremelly biased depth meaning barely impossible to generate
511
+ * deep structures, while `Number.POSITIVE_INFINITY` means "depth has no impact".
512
+ *
513
+ * Using `max` or `Number.POSITIVE_INFINITY` is fully equivalent.
514
+ *
515
+ * @remarks Since 2.25.0
516
+ * @public
517
+ */
518
+ type DepthSize = RelativeSize | Size | "max" | number | undefined;
519
+ //#endregion
520
+ //#region src/check/runner/configuration/RandomType.d.ts
521
+ /**
522
+ * Random generators automatically recognized by the framework
523
+ * without having to pass a builder function
524
+ * @remarks Since 2.2.0
525
+ * @public
526
+ */
527
+ type RandomType = "mersenne" | "congruential" | "congruential32" | "xorshift128plus" | "xoroshiro128plus";
528
+ //#endregion
529
+ //#region src/check/runner/configuration/VerbosityLevel.d.ts
530
+ /**
531
+ * Verbosity level
532
+ * @remarks Since 1.9.1
533
+ * @public
534
+ */
535
+ declare enum VerbosityLevel {
536
+ /**
537
+ * Level 0 (default)
538
+ *
539
+ * Minimal reporting:
540
+ * - minimal failing case
541
+ * - error log corresponding to the minimal failing case
542
+ *
543
+ * @remarks Since 1.9.1
544
+ */
545
+ None = 0,
546
+ /**
547
+ * Level 1
548
+ *
549
+ * Failures reporting:
550
+ * - same as `VerbosityLevel.None`
551
+ * - list all the failures encountered during the shrinking process
552
+ *
553
+ * @remarks Since 1.9.1
554
+ */
555
+ Verbose = 1,
556
+ /**
557
+ * Level 2
558
+ *
559
+ * Execution flow reporting:
560
+ * - same as `VerbosityLevel.None`
561
+ * - all runs with their associated status displayed as a tree
562
+ *
563
+ * @remarks Since 1.9.1
564
+ */
565
+ VeryVerbose = 2
566
+ }
567
+ //#endregion
568
+ //#region src/check/runner/reporter/ExecutionStatus.d.ts
569
+ /**
570
+ * Status of the execution of the property
571
+ * @remarks Since 1.9.0
572
+ * @public
573
+ */
574
+ declare enum ExecutionStatus {
575
+ Success = 0,
576
+ Skipped = -1,
577
+ Failure = 1
578
+ }
579
+ //#endregion
580
+ //#region src/check/runner/reporter/ExecutionTree.d.ts
581
+ /**
582
+ * Summary of the execution process
583
+ * @remarks Since 1.9.0
584
+ * @public
585
+ */
586
+ interface ExecutionTree<Ts> {
587
+ /**
588
+ * Status of the property
589
+ * @remarks Since 1.9.0
590
+ */
591
+ status: ExecutionStatus;
592
+ /**
593
+ * Generated value
594
+ * @remarks Since 1.9.0
595
+ */
596
+ value: Ts;
597
+ /**
598
+ * Values derived from this value
599
+ * @remarks Since 1.9.0
600
+ */
601
+ children: ExecutionTree<Ts>[];
602
+ }
603
+ //#endregion
604
+ //#region src/check/runner/reporter/RunDetails.d.ts
605
+ /**
606
+ * Post-run details produced by {@link check}
607
+ *
608
+ * A failing property can easily detected by checking the `failed` flag of this structure
609
+ *
610
+ * @remarks Since 0.0.7
611
+ * @public
612
+ */
613
+ type RunDetails<Ts> = RunDetailsFailureProperty<Ts> | RunDetailsFailureTooManySkips<Ts> | RunDetailsFailureInterrupted<Ts> | RunDetailsSuccess<Ts>;
614
+ /**
615
+ * Run reported as failed because
616
+ * the property failed
617
+ *
618
+ * Refer to {@link RunDetailsCommon} for more details
619
+ *
620
+ * @remarks Since 1.25.0
621
+ * @public
622
+ */
623
+ interface RunDetailsFailureProperty<Ts> extends RunDetailsCommon<Ts> {
624
+ failed: true;
625
+ interrupted: boolean;
626
+ counterexample: Ts;
627
+ counterexamplePath: string;
628
+ errorInstance: unknown;
629
+ }
630
+ /**
631
+ * Run reported as failed because
632
+ * too many retries have been attempted to generate valid values
633
+ *
634
+ * Refer to {@link RunDetailsCommon} for more details
635
+ *
636
+ * @remarks Since 1.25.0
637
+ * @public
638
+ */
639
+ interface RunDetailsFailureTooManySkips<Ts> extends RunDetailsCommon<Ts> {
640
+ failed: true;
641
+ interrupted: false;
642
+ counterexample: null;
643
+ counterexamplePath: null;
644
+ errorInstance: null;
645
+ }
646
+ /**
647
+ * Run reported as failed because
648
+ * it took too long and thus has been interrupted
649
+ *
650
+ * Refer to {@link RunDetailsCommon} for more details
651
+ *
652
+ * @remarks Since 1.25.0
653
+ * @public
654
+ */
655
+ interface RunDetailsFailureInterrupted<Ts> extends RunDetailsCommon<Ts> {
656
+ failed: true;
657
+ interrupted: true;
658
+ counterexample: null;
659
+ counterexamplePath: null;
660
+ errorInstance: null;
661
+ }
662
+ /**
663
+ * Run reported as success
664
+ *
665
+ * Refer to {@link RunDetailsCommon} for more details
666
+ *
667
+ * @remarks Since 1.25.0
668
+ * @public
669
+ */
670
+ interface RunDetailsSuccess<Ts> extends RunDetailsCommon<Ts> {
671
+ failed: false;
672
+ interrupted: boolean;
673
+ counterexample: null;
674
+ counterexamplePath: null;
675
+ errorInstance: null;
676
+ }
677
+ /**
678
+ * Shared part between variants of RunDetails
679
+ * @remarks Since 2.2.0
680
+ * @public
681
+ */
682
+ interface RunDetailsCommon<Ts> {
683
+ /**
684
+ * Does the property failed during the execution of {@link check}?
685
+ * @remarks Since 0.0.7
686
+ */
687
+ failed: boolean;
688
+ /**
689
+ * Was the execution interrupted?
690
+ * @remarks Since 1.19.0
691
+ */
692
+ interrupted: boolean;
693
+ /**
694
+ * Number of runs
695
+ *
696
+ * - In case of failed property: Number of runs up to the first failure (including the failure run)
697
+ * - Otherwise: Number of successful executions
698
+ *
699
+ * @remarks Since 1.0.0
700
+ */
701
+ numRuns: number;
702
+ /**
703
+ * Number of skipped entries due to failed pre-condition
704
+ *
705
+ * As `numRuns` it only takes into account the skipped values that occured before the first failure.
706
+ * Refer to {@link pre} to add such pre-conditions.
707
+ *
708
+ * @remarks Since 1.3.0
709
+ */
710
+ numSkips: number;
711
+ /**
712
+ * Number of shrinks required to get to the minimal failing case (aka counterexample)
713
+ * @remarks Since 1.0.0
714
+ */
715
+ numShrinks: number;
716
+ /**
717
+ * Seed that have been used by the run
718
+ *
719
+ * It can be forced in {@link assert}, {@link check}, {@link sample} and {@link statistics} using `Parameters`
720
+ * @remarks Since 0.0.7
721
+ */
722
+ seed: number;
723
+ /**
724
+ * In case of failure: the counterexample contains the minimal failing case (first failure after shrinking)
725
+ * @remarks Since 0.0.7
726
+ */
727
+ counterexample: Ts | null;
728
+ /**
729
+ * In case of failure: it contains the error that has been thrown if any
730
+ * @remarks Since 3.0.0
731
+ */
732
+ errorInstance: unknown | null;
733
+ /**
734
+ * In case of failure: path to the counterexample
735
+ *
736
+ * For replay purposes, it can be forced in {@link assert}, {@link check}, {@link sample} and {@link statistics} using `Parameters`
737
+ *
738
+ * @remarks Since 1.0.0
739
+ */
740
+ counterexamplePath: string | null;
741
+ /**
742
+ * List all failures that have occurred during the run
743
+ *
744
+ * You must enable verbose with at least `Verbosity.Verbose` in `Parameters`
745
+ * in order to have values in it
746
+ *
747
+ * @remarks Since 1.1.0
748
+ */
749
+ failures: Ts[];
750
+ /**
751
+ * Execution summary of the run
752
+ *
753
+ * Traces the origin of each value encountered during the test and its execution status.
754
+ * Can help to diagnose shrinking issues.
755
+ *
756
+ * You must enable verbose with at least `Verbosity.Verbose` in `Parameters`
757
+ * in order to have values in it:
758
+ * - Verbose: Only failures
759
+ * - VeryVerbose: Failures, Successes and Skipped
760
+ *
761
+ * @remarks Since 1.9.0
762
+ */
763
+ executionSummary: ExecutionTree<Ts>[];
764
+ /**
765
+ * Verbosity level required by the user
766
+ * @remarks Since 1.9.0
767
+ */
768
+ verbose: VerbosityLevel;
769
+ /**
770
+ * Configuration of the run
771
+ *
772
+ * It includes both local parameters set on {@link check} or {@link assert}
773
+ * and global ones specified using {@link configureGlobal}
774
+ *
775
+ * @remarks Since 1.25.0
776
+ */
777
+ runConfiguration: Parameters<Ts>;
778
+ }
779
+ //#endregion
780
+ //#region src/check/runner/configuration/Parameters.d.ts
781
+ /**
782
+ * Customization of the parameters used to run the properties
783
+ * @remarks Since 0.0.6
784
+ * @public
785
+ */
786
+ interface Parameters<T = void> {
787
+ /**
788
+ * Initial seed of the generator: `Date.now()` by default
789
+ *
790
+ * It can be forced to replay a failed run.
791
+ *
792
+ * In theory, seeds are supposed to be 32-bit integers.
793
+ * In case of double value, the seed will be rescaled into a valid 32-bit integer (eg.: values between 0 and 1 will be evenly spread into the range of possible seeds).
794
+ *
795
+ * @remarks Since 0.0.6
796
+ */
797
+ seed?: number;
798
+ /**
799
+ * Random number generator: `xorshift128plus` by default
800
+ *
801
+ * Random generator is the core element behind the generation of random values - changing it might directly impact the quality and performances of the generation of random values.
802
+ * It can be one of: 'mersenne', 'congruential', 'congruential32', 'xorshift128plus', 'xoroshiro128plus'
803
+ * Or any function able to build a `RandomGenerator` based on a seed
804
+ *
805
+ * As required since pure-rand v6.0.0, when passing a builder for {@link RandomGenerator},
806
+ * the random number generator must generate values between -0x80000000 and 0x7fffffff.
807
+ *
808
+ * @remarks Since 1.6.0
809
+ */
810
+ randomType?: RandomType | ((seed: number) => RandomGenerator);
811
+ /**
812
+ * Number of runs before success: 100 by default
813
+ * @remarks Since 1.0.0
814
+ */
815
+ numRuns?: number;
816
+ /**
817
+ * Maximal number of skipped values per run
818
+ *
819
+ * Skipped is considered globally, so this value is used to compute maxSkips = maxSkipsPerRun * numRuns.
820
+ * Runner will consider a run to have failed if it skipped maxSkips+1 times before having generated numRuns valid entries.
821
+ *
822
+ * See {@link pre} for more details on pre-conditions
823
+ *
824
+ * @remarks Since 1.3.0
825
+ */
826
+ maxSkipsPerRun?: number;
827
+ /**
828
+ * Maximum time in milliseconds for the predicate to answer: disabled by default
829
+ *
830
+ * WARNING: Only works for async code (see {@link asyncProperty}), will not interrupt a synchronous code.
831
+ * @remarks Since 0.0.11
832
+ */
833
+ timeout?: number;
834
+ /**
835
+ * Skip all runs after a given time limit: disabled by default
836
+ *
837
+ * NOTE: Relies on `Date.now()`.
838
+ *
839
+ * NOTE:
840
+ * Useful to stop too long shrinking processes.
841
+ * Replay capability (see `seed`, `path`) can resume the shrinking.
842
+ *
843
+ * WARNING:
844
+ * It skips runs. Thus test might be marked as failed.
845
+ * Indeed, it might not reached the requested number of successful runs.
846
+ *
847
+ * @remarks Since 1.15.0
848
+ */
849
+ skipAllAfterTimeLimit?: number;
850
+ /**
851
+ * Interrupt test execution after a given time limit: disabled by default
852
+ *
853
+ * NOTE: Relies on `Date.now()`.
854
+ *
855
+ * NOTE:
856
+ * Useful to avoid having too long running processes in your CI.
857
+ * Replay capability (see `seed`, `path`) can still be used if needed.
858
+ *
859
+ * WARNING:
860
+ * If the test got interrupted before any failure occured
861
+ * and before it reached the requested number of runs specified by `numRuns`
862
+ * it will be marked as success. Except if `markInterruptAsFailure` has been set to `true`
863
+ *
864
+ * @remarks Since 1.19.0
865
+ */
866
+ interruptAfterTimeLimit?: number;
867
+ /**
868
+ * Mark interrupted runs as failed runs if preceded by one success or more: disabled by default
869
+ * Interrupted with no success at all always defaults to failure whatever the value of this flag.
870
+ * @remarks Since 1.19.0
871
+ */
872
+ markInterruptAsFailure?: boolean;
873
+ /**
874
+ * Skip runs corresponding to already tried values.
875
+ *
876
+ * WARNING:
877
+ * Discarded runs will be retried. Under the hood they are simple calls to `fc.pre`.
878
+ * In other words, if you ask for 100 runs but your generator can only generate 10 values then the property will fail as 100 runs will never be reached.
879
+ * Contrary to `ignoreEqualValues` you always have the number of runs you requested.
880
+ *
881
+ * NOTE: Relies on `fc.stringify` to check the equality.
882
+ *
883
+ * @remarks Since 2.14.0
884
+ */
885
+ skipEqualValues?: boolean;
886
+ /**
887
+ * Discard runs corresponding to already tried values.
888
+ *
889
+ * WARNING:
890
+ * Discarded runs will not be replaced.
891
+ * In other words, if you ask for 100 runs and have 2 discarded runs you will only have 98 effective runs.
892
+ *
893
+ * NOTE: Relies on `fc.stringify` to check the equality.
894
+ *
895
+ * @remarks Since 2.14.0
896
+ */
897
+ ignoreEqualValues?: boolean;
898
+ /**
899
+ * Way to replay a failing property directly with the counterexample.
900
+ * It can be fed with the counterexamplePath returned by the failing test (requires `seed` too).
901
+ * @remarks Since 1.0.0
902
+ */
903
+ path?: string;
904
+ /**
905
+ * Logger (see {@link statistics}): `console.log` by default
906
+ * @remarks Since 0.0.6
907
+ */
908
+ logger?(v: string): void;
909
+ /**
910
+ * Force the use of unbiased arbitraries: biased by default
911
+ * @remarks Since 1.1.0
912
+ */
913
+ unbiased?: boolean;
914
+ /**
915
+ * Enable verbose mode: {@link VerbosityLevel.None} by default
916
+ *
917
+ * Using `verbose: true` is equivalent to `verbose: VerbosityLevel.Verbose`
918
+ *
919
+ * It can prove very useful to troubleshoot issues.
920
+ * See {@link VerbosityLevel} for more details on each level.
921
+ *
922
+ * @remarks Since 1.1.0
923
+ */
924
+ verbose?: boolean | VerbosityLevel;
925
+ /**
926
+ * Custom values added at the beginning of generated ones
927
+ *
928
+ * It enables users to come with examples they want to test at every run
929
+ *
930
+ * @remarks Since 1.4.0
931
+ */
932
+ examples?: T[];
933
+ /**
934
+ * Stop run on failure
935
+ *
936
+ * It makes the run stop at the first encountered failure without shrinking.
937
+ *
938
+ * When used in complement to `seed` and `path`,
939
+ * it replays only the minimal counterexample.
940
+ *
941
+ * @remarks Since 1.11.0
942
+ */
943
+ endOnFailure?: boolean;
944
+ /**
945
+ * Replace the default reporter handling errors by a custom one
946
+ *
947
+ * Reporter is responsible to throw in case of failure: default one throws whenever `runDetails.failed` is true.
948
+ * But you may want to change this behaviour in yours.
949
+ *
950
+ * Only used when calling {@link assert}
951
+ * Cannot be defined in conjonction with `asyncReporter`
952
+ *
953
+ * @remarks Since 1.25.0
954
+ */
955
+ reporter?: (runDetails: RunDetails<T>) => void;
956
+ /**
957
+ * Replace the default reporter handling errors by a custom one
958
+ *
959
+ * Reporter is responsible to throw in case of failure: default one throws whenever `runDetails.failed` is true.
960
+ * But you may want to change this behaviour in yours.
961
+ *
962
+ * Only used when calling {@link assert}
963
+ * Cannot be defined in conjonction with `reporter`
964
+ * Not compatible with synchronous properties: runner will throw
965
+ *
966
+ * @remarks Since 1.25.0
967
+ */
968
+ asyncReporter?: (runDetails: RunDetails<T>) => Promise<void>;
969
+ /**
970
+ * By default the Error causing the failure of the predicate will not be directly exposed within the message
971
+ * of the Error thown by fast-check. It will be exposed by a cause field attached to the Error.
972
+ *
973
+ * The Error with cause has been supported by Node since 16.14.0 and is properly supported in many test runners.
974
+ *
975
+ * But if the original Error fails to appear within your test runner,
976
+ * Or if you prefer the Error to be included directly as part of the message of the resulted Error,
977
+ * you can toggle this flag and the Error produced by fast-check in case of failure will expose the source Error
978
+ * as part of the message and not as a cause.
979
+ */
980
+ includeErrorInReport?: boolean;
981
+ }
982
+ //#endregion
983
+ //#region src/check/runner/configuration/GlobalParameters.d.ts
984
+ /**
985
+ * Type of legal hook function that can be used in the global parameter `beforeEach` and/or `afterEach`
986
+ * @remarks Since 2.3.0
987
+ * @public
988
+ */
989
+ type GlobalPropertyHookFunction = () => void;
990
+ /**
991
+ * Type of legal hook function that can be used in the global parameter `asyncBeforeEach` and/or `asyncAfterEach`
992
+ * @remarks Since 2.3.0
993
+ * @public
994
+ */
995
+ type GlobalAsyncPropertyHookFunction = (() => Promise<unknown>) | (() => void);
996
+ /**
997
+ * Type describing the global overrides
998
+ * @remarks Since 1.18.0
999
+ * @public
1000
+ */
1001
+ type GlobalParameters = Pick<Parameters<unknown>, Exclude<keyof Parameters<unknown>, "path" | "examples">> & {
1002
+ /**
1003
+ * Specify a function that will be called before each execution of a property.
1004
+ * It behaves as-if you manually called `beforeEach` method on all the properties you execute with fast-check.
1005
+ *
1006
+ * The function will be used for both {@link fast-check#property} and {@link fast-check#asyncProperty}.
1007
+ * This global override should never be used in conjunction with `asyncBeforeEach`.
1008
+ *
1009
+ * @remarks Since 2.3.0
1010
+ */
1011
+ beforeEach?: GlobalPropertyHookFunction;
1012
+ /**
1013
+ * Specify a function that will be called after each execution of a property.
1014
+ * It behaves as-if you manually called `afterEach` method on all the properties you execute with fast-check.
1015
+ *
1016
+ * The function will be used for both {@link fast-check#property} and {@link fast-check#asyncProperty}.
1017
+ * This global override should never be used in conjunction with `asyncAfterEach`.
1018
+ *
1019
+ * @remarks Since 2.3.0
1020
+ */
1021
+ afterEach?: GlobalPropertyHookFunction;
1022
+ /**
1023
+ * Specify a function that will be called before each execution of an asynchronous property.
1024
+ * It behaves as-if you manually called `beforeEach` method on all the asynchronous properties you execute with fast-check.
1025
+ *
1026
+ * The function will be used only for {@link fast-check#asyncProperty}. It makes synchronous properties created by {@link fast-check#property} unable to run.
1027
+ * This global override should never be used in conjunction with `beforeEach`.
1028
+ *
1029
+ * @remarks Since 2.3.0
1030
+ */
1031
+ asyncBeforeEach?: GlobalAsyncPropertyHookFunction;
1032
+ /**
1033
+ * Specify a function that will be called after each execution of an asynchronous property.
1034
+ * It behaves as-if you manually called `afterEach` method on all the asynchronous properties you execute with fast-check.
1035
+ *
1036
+ * The function will be used only for {@link fast-check#asyncProperty}. It makes synchronous properties created by {@link fast-check#property} unable to run.
1037
+ * This global override should never be used in conjunction with `afterEach`.
1038
+ *
1039
+ * @remarks Since 2.3.0
1040
+ */
1041
+ asyncAfterEach?: GlobalAsyncPropertyHookFunction;
1042
+ /**
1043
+ * Define the base size to be used by arbitraries.
1044
+ *
1045
+ * By default arbitraries not specifying any size will default to it (except in some cases when used defaultSizeToMaxWhenMaxSpecified is true).
1046
+ * For some arbitraries users will want to override the default and either define another size relative to this one,
1047
+ * or a fixed one.
1048
+ *
1049
+ * @defaultValue `"small"`
1050
+ * @remarks Since 2.22.0
1051
+ */
1052
+ baseSize?: Size;
1053
+ /**
1054
+ * When set to `true` and if the size has not been defined for this precise instance,
1055
+ * it will automatically default to `"max"` if the user specified a upper bound for the range
1056
+ * (applies to length and to depth).
1057
+ *
1058
+ * When `false`, the size will be defaulted to `baseSize` even if the user specified
1059
+ * a upper bound for the range.
1060
+ *
1061
+ * @remarks Since 2.22.0
1062
+ */
1063
+ defaultSizeToMaxWhenMaxSpecified?: boolean;
1064
+ };
1065
+ /**
1066
+ * Define global parameters that will be used by all the runners
1067
+ *
1068
+ * @example
1069
+ * ```typescript
1070
+ * fc.configureGlobal({ numRuns: 10 });
1071
+ * //...
1072
+ * fc.assert(
1073
+ * fc.property(
1074
+ * fc.nat(), fc.nat(),
1075
+ * (a, b) => a + b === b + a
1076
+ * ), { seed: 42 }
1077
+ * ) // equivalent to { numRuns: 10, seed: 42 }
1078
+ * ```
1079
+ *
1080
+ * @param parameters - Global parameters
1081
+ *
1082
+ * @remarks Since 1.18.0
1083
+ * @public
1084
+ */
1085
+ declare function configureGlobal(parameters: GlobalParameters): void;
1086
+ /**
1087
+ * Read global parameters that will be used by runners
1088
+ * @remarks Since 1.18.0
1089
+ * @public
1090
+ */
1091
+ declare function readConfigureGlobal(): GlobalParameters;
1092
+ /**
1093
+ * Reset global parameters
1094
+ * @remarks Since 1.18.0
1095
+ * @public
1096
+ */
1097
+ declare function resetConfigureGlobal(): void;
1098
+ //#endregion
1099
+ //#region src/check/property/AsyncProperty.generic.d.ts
1100
+ /**
1101
+ * Type of legal hook function that can be used to call `beforeEach` or `afterEach`
1102
+ * on a {@link IAsyncPropertyWithHooks}
1103
+ *
1104
+ * @remarks Since 2.2.0
1105
+ * @public
1106
+ */
1107
+ type AsyncPropertyHookFunction = ((previousHookFunction: GlobalAsyncPropertyHookFunction) => Promise<unknown>) | ((previousHookFunction: GlobalAsyncPropertyHookFunction) => void);
1108
+ /**
1109
+ * Interface for asynchronous property, see {@link IRawProperty}
1110
+ * @remarks Since 1.19.0
1111
+ * @public
1112
+ */
1113
+ interface IAsyncProperty<Ts> extends IRawProperty<Ts, true> {}
1114
+ /**
1115
+ * Interface for asynchronous property defining hooks, see {@link IAsyncProperty}
1116
+ * @remarks Since 2.2.0
1117
+ * @public
1118
+ */
1119
+ interface IAsyncPropertyWithHooks<Ts> extends IAsyncProperty<Ts> {
1120
+ /**
1121
+ * Define a function that should be called before all calls to the predicate
1122
+ * @param hookFunction - Function to be called
1123
+ * @remarks Since 1.6.0
1124
+ */
1125
+ beforeEach(hookFunction: AsyncPropertyHookFunction): IAsyncPropertyWithHooks<Ts>;
1126
+ /**
1127
+ * Define a function that should be called after all calls to the predicate
1128
+ * @param hookFunction - Function to be called
1129
+ * @remarks Since 1.6.0
1130
+ */
1131
+ afterEach(hookFunction: AsyncPropertyHookFunction): IAsyncPropertyWithHooks<Ts>;
1132
+ }
1133
+ //#endregion
1134
+ //#region src/check/property/AsyncProperty.d.ts
1135
+ /**
1136
+ * Instantiate a new {@link fast-check#IAsyncProperty}
1137
+ * @param predicate - Assess the success of the property. Would be considered falsy if it throws or if its output evaluates to false
1138
+ * @remarks Since 0.0.7
1139
+ * @public
1140
+ */
1141
+ declare function asyncProperty<Ts extends [unknown, ...unknown[]]>(...args: [...arbitraries: { [K in keyof Ts]: Arbitrary<Ts[K]> }, predicate: (...args: Ts) => Promise<boolean | void>]): IAsyncPropertyWithHooks<Ts>;
1142
+ //#endregion
1143
+ //#region src/check/property/Property.generic.d.ts
1144
+ /**
1145
+ * Type of legal hook function that can be used to call `beforeEach` or `afterEach`
1146
+ * on a {@link IPropertyWithHooks}
1147
+ *
1148
+ * @remarks Since 2.2.0
1149
+ * @public
1150
+ */
1151
+ type PropertyHookFunction = (globalHookFunction: GlobalPropertyHookFunction) => void;
1152
+ /**
1153
+ * Interface for synchronous property, see {@link IRawProperty}
1154
+ * @remarks Since 1.19.0
1155
+ * @public
1156
+ */
1157
+ interface IProperty<Ts> extends IRawProperty<Ts, false> {}
1158
+ /**
1159
+ * Interface for synchronous property defining hooks, see {@link IProperty}
1160
+ * @remarks Since 2.2.0
1161
+ * @public
1162
+ */
1163
+ interface IPropertyWithHooks<Ts> extends IProperty<Ts> {
1164
+ /**
1165
+ * Define a function that should be called before all calls to the predicate
1166
+ * @param invalidHookFunction - Function to be called, please provide a valid hook function
1167
+ * @remarks Since 1.6.0
1168
+ */
1169
+ beforeEach(invalidHookFunction: (hookFunction: GlobalPropertyHookFunction) => Promise<unknown>): "beforeEach expects a synchronous function but was given a function returning a Promise";
1170
+ /**
1171
+ * Define a function that should be called before all calls to the predicate
1172
+ * @param hookFunction - Function to be called
1173
+ * @remarks Since 1.6.0
1174
+ */
1175
+ beforeEach(hookFunction: PropertyHookFunction): IPropertyWithHooks<Ts>;
1176
+ /**
1177
+ * Define a function that should be called after all calls to the predicate
1178
+ * @param invalidHookFunction - Function to be called, please provide a valid hook function
1179
+ * @remarks Since 1.6.0
1180
+ */
1181
+ afterEach(invalidHookFunction: (hookFunction: GlobalPropertyHookFunction) => Promise<unknown>): "afterEach expects a synchronous function but was given a function returning a Promise";
1182
+ /**
1183
+ * Define a function that should be called after all calls to the predicate
1184
+ * @param hookFunction - Function to be called
1185
+ * @remarks Since 1.6.0
1186
+ */
1187
+ afterEach(hookFunction: PropertyHookFunction): IPropertyWithHooks<Ts>;
1188
+ }
1189
+ //#endregion
1190
+ //#region src/check/property/Property.d.ts
1191
+ /**
1192
+ * Instantiate a new {@link fast-check#IProperty}
1193
+ * @param predicate - Assess the success of the property. Would be considered falsy if it throws or if its output evaluates to false
1194
+ * @remarks Since 0.0.1
1195
+ * @public
1196
+ */
1197
+ declare function property<Ts extends [unknown, ...unknown[]]>(...args: [...arbitraries: { [K in keyof Ts]: Arbitrary<Ts[K]> }, predicate: (...args: Ts) => boolean | void]): IPropertyWithHooks<Ts>;
1198
+ //#endregion
1199
+ //#region src/check/runner/Runner.d.ts
1200
+ /**
1201
+ * Run the property, do not throw contrary to {@link assert}
1202
+ *
1203
+ * WARNING: Has to be awaited
1204
+ *
1205
+ * @param property - Asynchronous property to be checked
1206
+ * @param params - Optional parameters to customize the execution
1207
+ *
1208
+ * @returns Test status and other useful details
1209
+ *
1210
+ * @remarks Since 0.0.7
1211
+ * @public
1212
+ */
1213
+ declare function check<Ts>(property: IAsyncProperty<Ts>, params?: Parameters<Ts>): Promise<RunDetails<Ts>>;
1214
+ /**
1215
+ * Run the property, do not throw contrary to {@link assert}
1216
+ *
1217
+ * @param property - Synchronous property to be checked
1218
+ * @param params - Optional parameters to customize the execution
1219
+ *
1220
+ * @returns Test status and other useful details
1221
+ *
1222
+ * @remarks Since 0.0.1
1223
+ * @public
1224
+ */
1225
+ declare function check<Ts>(property: IProperty<Ts>, params?: Parameters<Ts>): RunDetails<Ts>;
1226
+ /**
1227
+ * Run the property, do not throw contrary to {@link assert}
1228
+ *
1229
+ * WARNING: Has to be awaited if the property is asynchronous
1230
+ *
1231
+ * @param property - Property to be checked
1232
+ * @param params - Optional parameters to customize the execution
1233
+ *
1234
+ * @returns Test status and other useful details
1235
+ *
1236
+ * @remarks Since 0.0.7
1237
+ * @public
1238
+ */
1239
+ declare function check<Ts>(property: IRawProperty<Ts>, params?: Parameters<Ts>): Promise<RunDetails<Ts>> | RunDetails<Ts>;
1240
+ /**
1241
+ * Run the property, throw in case of failure
1242
+ *
1243
+ * It can be called directly from describe/it blocks of Mocha.
1244
+ * No meaningful results are produced in case of success.
1245
+ *
1246
+ * WARNING: Has to be awaited
1247
+ *
1248
+ * @param property - Asynchronous property to be checked
1249
+ * @param params - Optional parameters to customize the execution
1250
+ *
1251
+ * @remarks Since 0.0.7
1252
+ * @public
1253
+ */
1254
+ declare function assert<Ts>(property: IAsyncProperty<Ts>, params?: Parameters<Ts>): Promise<void>;
1255
+ /**
1256
+ * Run the property, throw in case of failure
1257
+ *
1258
+ * It can be called directly from describe/it blocks of Mocha.
1259
+ * No meaningful results are produced in case of success.
1260
+ *
1261
+ * @param property - Synchronous property to be checked
1262
+ * @param params - Optional parameters to customize the execution
1263
+ *
1264
+ * @remarks Since 0.0.1
1265
+ * @public
1266
+ */
1267
+ declare function assert<Ts>(property: IProperty<Ts>, params?: Parameters<Ts>): void;
1268
+ /**
1269
+ * Run the property, throw in case of failure
1270
+ *
1271
+ * It can be called directly from describe/it blocks of Mocha.
1272
+ * No meaningful results are produced in case of success.
1273
+ *
1274
+ * WARNING: Returns a promise to be awaited if the property is asynchronous
1275
+ *
1276
+ * @param property - Synchronous or asynchronous property to be checked
1277
+ * @param params - Optional parameters to customize the execution
1278
+ *
1279
+ * @remarks Since 0.0.7
1280
+ * @public
1281
+ */
1282
+ declare function assert<Ts>(property: IRawProperty<Ts>, params?: Parameters<Ts>): Promise<void> | void;
1283
+ //#endregion
1284
+ //#region src/check/runner/Sampler.d.ts
1285
+ /**
1286
+ * Generate an array containing all the values that would have been generated during {@link assert} or {@link check}
1287
+ *
1288
+ * @example
1289
+ * ```typescript
1290
+ * fc.sample(fc.nat(), 10); // extract 10 values from fc.nat() Arbitrary
1291
+ * fc.sample(fc.nat(), {seed: 42}); // extract values from fc.nat() as if we were running fc.assert with seed=42
1292
+ * ```
1293
+ *
1294
+ * @param generator - {@link IProperty} or {@link Arbitrary} to extract the values from
1295
+ * @param params - Integer representing the number of values to generate or `Parameters` as in {@link assert}
1296
+ *
1297
+ * @remarks Since 0.0.6
1298
+ * @public
1299
+ */
1300
+ declare function sample<Ts>(generator: IRawProperty<Ts> | Arbitrary<Ts>, params?: Parameters<Ts> | number): Ts[];
1301
+ /**
1302
+ * Gather useful statistics concerning generated values
1303
+ *
1304
+ * Print the result in `console.log` or `params.logger` (if defined)
1305
+ *
1306
+ * @example
1307
+ * ```typescript
1308
+ * fc.statistics(
1309
+ * fc.nat(999),
1310
+ * v => v < 100 ? 'Less than 100' : 'More or equal to 100',
1311
+ * {numRuns: 1000, logger: console.log});
1312
+ * // Classify 1000 values generated by fc.nat(999) into two categories:
1313
+ * // - Less than 100
1314
+ * // - More or equal to 100
1315
+ * // The output will be sent line by line to the logger
1316
+ * ```
1317
+ *
1318
+ * @param generator - {@link IProperty} or {@link Arbitrary} to extract the values from
1319
+ * @param classify - Classifier function that can classify the generated value in zero, one or more categories (with free labels)
1320
+ * @param params - Integer representing the number of values to generate or `Parameters` as in {@link assert}
1321
+ *
1322
+ * @remarks Since 0.0.6
1323
+ * @public
1324
+ */
1325
+ declare function statistics<Ts>(generator: IRawProperty<Ts> | Arbitrary<Ts>, classify: (v: Ts) => string | string[], params?: Parameters<Ts> | number): void;
1326
+ //#endregion
1327
+ //#region src/arbitrary/_internals/builders/GeneratorValueBuilder.d.ts
1328
+ /**
1329
+ * Take an arbitrary builder and all its arguments separatly.
1330
+ * Generate a value out of it.
1331
+ *
1332
+ * @remarks Since 3.8.0
1333
+ * @public
1334
+ */
1335
+ type GeneratorValueFunction = <T, TArgs extends unknown[]>(arb: (...params: TArgs) => Arbitrary<T>, ...args: TArgs) => T;
1336
+ /**
1337
+ * The values part is mostly exposed for the purpose of the tests.
1338
+ * Or if you want to have a custom error formatter for this kind of values.
1339
+ *
1340
+ * @remarks Since 3.8.0
1341
+ * @public
1342
+ */
1343
+ type GeneratorValueMethods = {
1344
+ values: () => unknown[];
1345
+ };
1346
+ /**
1347
+ * An instance of {@link GeneratorValue} can be leveraged within predicates themselves to produce extra random values
1348
+ * while preserving part of the shrinking capabilities on the produced values.
1349
+ *
1350
+ * It can be seen as a way to start property based testing within something looking closer from what users will
1351
+ * think about when thinking about random in tests. But contrary to raw random, it comes with many useful strengths
1352
+ * such as: ability to re-run the test (seeded), shrinking...
1353
+ *
1354
+ * @remarks Since 3.8.0
1355
+ * @public
1356
+ */
1357
+ type GeneratorValue = GeneratorValueFunction & GeneratorValueMethods;
1358
+ //#endregion
1359
+ //#region src/arbitrary/gen.d.ts
1360
+ /**
1361
+ * Generate values within the test execution itself by leveraging the strength of `gen`
1362
+ *
1363
+ * @example
1364
+ * ```javascript
1365
+ * fc.assert(
1366
+ * fc.property(fc.gen(), gen => {
1367
+ * const size = gen(fc.nat, {max: 10});
1368
+ * const array = [];
1369
+ * for (let index = 0 ; index !== size ; ++index) {
1370
+ * array.push(gen(fc.integer));
1371
+ * }
1372
+ * // Here is an array!
1373
+ * // Note: Prefer fc.array(fc.integer(), {maxLength: 10}) if you want to produce such array
1374
+ * })
1375
+ * )
1376
+ * ```
1377
+ *
1378
+ * ⚠️ WARNING:
1379
+ * While `gen` is easy to use, it may not shrink as well as tailored arbitraries based on `filter` or `map`.
1380
+ *
1381
+ * ⚠️ WARNING:
1382
+ * Additionally it cannot run back the test properly when attempting to replay based on a seed and a path.
1383
+ * You'll need to limit yourself to the seed and drop the path from the options if you attempt to replay something
1384
+ * implying it. More precisely, you may keep the very first part of the path but have to drop anything after the
1385
+ * first ":".
1386
+ *
1387
+ * ⚠️ WARNING:
1388
+ * It also does not support custom examples.
1389
+ *
1390
+ * @remarks Since 3.8.0
1391
+ * @public
1392
+ */
1393
+ declare function gen(): Arbitrary<GeneratorValue>;
1394
+ //#endregion
1395
+ //#region src/arbitrary/_internals/helpers/DepthContext.d.ts
1396
+ /**
1397
+ * Type used to strongly type instances of depth identifier while keeping internals
1398
+ * what they contain internally
1399
+ *
1400
+ * @remarks Since 2.25.0
1401
+ * @public
1402
+ */
1403
+ type DepthIdentifier = {} & DepthContext;
1404
+ /**
1405
+ * Instance of depth, can be used to alter the depth perceived by an arbitrary
1406
+ * or to bias your own arbitraries based on the current depth
1407
+ *
1408
+ * @remarks Since 2.25.0
1409
+ * @public
1410
+ */
1411
+ type DepthContext = {
1412
+ /**
1413
+ * Current depth (starts at 0, continues with 1, 2...).
1414
+ * Only made of integer values superior or equal to 0.
1415
+ *
1416
+ * Remark: Whenever altering the `depth` during a `generate`, please make sure to ALWAYS
1417
+ * reset it to its original value before you leave the `generate`. Otherwise the execution
1418
+ * will imply side-effects that will potentially impact the following runs and make replay
1419
+ * of the issue barely impossible.
1420
+ */
1421
+ depth: number;
1422
+ };
1423
+ /**
1424
+ * Get back the requested DepthContext
1425
+ * @remarks Since 2.25.0
1426
+ * @public
1427
+ */
1428
+ declare function getDepthContextFor(contextMeta: DepthContext | DepthIdentifier | string | undefined): DepthContext;
1429
+ /**
1430
+ * Create a new and unique instance of DepthIdentifier
1431
+ * that can be shared across multiple arbitraries if needed
1432
+ * @public
1433
+ */
1434
+ declare function createDepthIdentifier(): DepthIdentifier;
1435
+ //#endregion
1436
+ //#region src/arbitrary/array.d.ts
1437
+ /**
1438
+ * Constraints to be applied on {@link array}
1439
+ * @remarks Since 2.4.0
1440
+ * @public
1441
+ */
1442
+ interface ArrayConstraints {
1443
+ /**
1444
+ * Lower bound of the generated array size
1445
+ * @defaultValue 0
1446
+ * @remarks Since 2.4.0
1447
+ */
1448
+ minLength?: number;
1449
+ /**
1450
+ * Upper bound of the generated array size
1451
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
1452
+ * @remarks Since 2.4.0
1453
+ */
1454
+ maxLength?: number;
1455
+ /**
1456
+ * Define how large the generated values should be (at max)
1457
+ *
1458
+ * When used in conjonction with `maxLength`, `size` will be used to define
1459
+ * the upper bound of the generated array size while `maxLength` will be used
1460
+ * to define and document the general maximal length allowed for this case.
1461
+ *
1462
+ * @remarks Since 2.22.0
1463
+ */
1464
+ size?: SizeForArbitrary;
1465
+ /**
1466
+ * When receiving a depth identifier, the arbitrary will impact the depth
1467
+ * attached to it to avoid going too deep if it already generated lots of items.
1468
+ *
1469
+ * In other words, if the number of generated values within the collection is large
1470
+ * then the generated items will tend to be less deep to avoid creating structures a lot
1471
+ * larger than expected.
1472
+ *
1473
+ * For the moment, the depth is not taken into account to compute the number of items to
1474
+ * define for a precise generate call of the array. Just applied onto eligible items.
1475
+ *
1476
+ * @remarks Since 2.25.0
1477
+ */
1478
+ depthIdentifier?: DepthIdentifier | string;
1479
+ }
1480
+ /**
1481
+ * For arrays of values coming from `arb`
1482
+ *
1483
+ * @param arb - Arbitrary used to generate the values inside the array
1484
+ * @param constraints - Constraints to apply when building instances (since 2.4.0)
1485
+ *
1486
+ * @remarks Since 0.0.1
1487
+ * @public
1488
+ */
1489
+ declare function array<T>(arb: Arbitrary<T>, constraints?: ArrayConstraints): Arbitrary<T[]>;
1490
+ //#endregion
1491
+ //#region src/arbitrary/bigInt.d.ts
1492
+ /**
1493
+ * Constraints to be applied on {@link bigInt}
1494
+ * @remarks Since 2.6.0
1495
+ * @public
1496
+ */
1497
+ interface BigIntConstraints {
1498
+ /**
1499
+ * Lower bound for the generated bigints (eg.: -5n, 0n, BigInt(Number.MIN_SAFE_INTEGER))
1500
+ * @remarks Since 2.6.0
1501
+ */
1502
+ min?: bigint;
1503
+ /**
1504
+ * Upper bound for the generated bigints (eg.: -2n, 2147483647n, BigInt(Number.MAX_SAFE_INTEGER))
1505
+ * @remarks Since 2.6.0
1506
+ */
1507
+ max?: bigint;
1508
+ }
1509
+ /**
1510
+ * For bigint
1511
+ * @remarks Since 1.9.0
1512
+ * @public
1513
+ */
1514
+ declare function bigInt(): Arbitrary<bigint>;
1515
+ /**
1516
+ * For bigint between min (included) and max (included)
1517
+ *
1518
+ * @param min - Lower bound for the generated bigints (eg.: -5n, 0n, BigInt(Number.MIN_SAFE_INTEGER))
1519
+ * @param max - Upper bound for the generated bigints (eg.: -2n, 2147483647n, BigInt(Number.MAX_SAFE_INTEGER))
1520
+ *
1521
+ * @remarks Since 1.9.0
1522
+ * @public
1523
+ */
1524
+ declare function bigInt(min: bigint, max: bigint): Arbitrary<bigint>;
1525
+ /**
1526
+ * For bigint between min (included) and max (included)
1527
+ *
1528
+ * @param constraints - Constraints to apply when building instances
1529
+ *
1530
+ * @remarks Since 2.6.0
1531
+ * @public
1532
+ */
1533
+ declare function bigInt(constraints: BigIntConstraints): Arbitrary<bigint>;
1534
+ /**
1535
+ * For bigint between min (included) and max (included)
1536
+ *
1537
+ * @param args - Either min/max bounds as an object or constraints to apply when building instances
1538
+ *
1539
+ * @remarks Since 2.6.0
1540
+ * @public
1541
+ */
1542
+ declare function bigInt(...args: [] | [bigint, bigint] | [BigIntConstraints]): Arbitrary<bigint>;
1543
+ //#endregion
1544
+ //#region src/arbitrary/boolean.d.ts
1545
+ /**
1546
+ * For boolean values - `true` or `false`
1547
+ * @remarks Since 0.0.6
1548
+ * @public
1549
+ */
1550
+ declare function boolean(): Arbitrary<boolean>;
1551
+ //#endregion
1552
+ //#region src/arbitrary/falsy.d.ts
1553
+ /**
1554
+ * Constraints to be applied on {@link falsy}
1555
+ * @remarks Since 1.26.0
1556
+ * @public
1557
+ */
1558
+ interface FalsyContraints {
1559
+ /**
1560
+ * Enable falsy bigint value
1561
+ * @remarks Since 1.26.0
1562
+ */
1563
+ withBigInt?: boolean;
1564
+ }
1565
+ /**
1566
+ * Typing for values generated by {@link falsy}
1567
+ * @remarks Since 2.2.0
1568
+ * @public
1569
+ */
1570
+ type FalsyValue<TConstraints extends FalsyContraints = object> = false | null | 0 | "" | typeof NaN | undefined | (TConstraints extends {
1571
+ withBigInt: true;
1572
+ } ? 0n : never);
1573
+ /**
1574
+ * For falsy values:
1575
+ * - ''
1576
+ * - 0
1577
+ * - NaN
1578
+ * - false
1579
+ * - null
1580
+ * - undefined
1581
+ * - 0n (whenever withBigInt: true)
1582
+ *
1583
+ * @param constraints - Constraints to apply when building instances
1584
+ *
1585
+ * @remarks Since 1.26.0
1586
+ * @public
1587
+ */
1588
+ declare function falsy<TConstraints extends FalsyContraints>(constraints?: TConstraints): Arbitrary<FalsyValue<TConstraints>>;
1589
+ //#endregion
1590
+ //#region src/arbitrary/constant.d.ts
1591
+ /**
1592
+ * For `value`
1593
+ * @param value - The value to produce
1594
+ * @remarks Since 0.0.1
1595
+ * @public
1596
+ */
1597
+ declare function constant<const T>(value: T): Arbitrary<T>;
1598
+ //#endregion
1599
+ //#region src/arbitrary/constantFrom.d.ts
1600
+ /**
1601
+ * For one `...values` values - all equiprobable
1602
+ *
1603
+ * **WARNING**: It expects at least one value, otherwise it should throw
1604
+ *
1605
+ * @param values - Constant values to be produced (all values shrink to the first one)
1606
+ *
1607
+ * @remarks Since 0.0.12
1608
+ * @public
1609
+ */
1610
+ declare function constantFrom<const T = never>(...values: T[]): Arbitrary<T>;
1611
+ /**
1612
+ * For one `...values` values - all equiprobable
1613
+ *
1614
+ * **WARNING**: It expects at least one value, otherwise it should throw
1615
+ *
1616
+ * @param values - Constant values to be produced (all values shrink to the first one)
1617
+ *
1618
+ * @remarks Since 0.0.12
1619
+ * @public
1620
+ */
1621
+ declare function constantFrom<TArgs extends any[] | [any]>(...values: TArgs): Arbitrary<TArgs[number]>;
1622
+ //#endregion
1623
+ //#region src/arbitrary/context.d.ts
1624
+ /**
1625
+ * Execution context attached to one predicate run
1626
+ * @remarks Since 2.2.0
1627
+ * @public
1628
+ */
1629
+ interface ContextValue {
1630
+ /**
1631
+ * Log execution details during a test.
1632
+ * Very helpful when troubleshooting failures
1633
+ * @param data - Data to be logged into the current context
1634
+ * @remarks Since 1.8.0
1635
+ */
1636
+ log(data: string): void;
1637
+ /**
1638
+ * Number of logs already logged into current context
1639
+ * @remarks Since 1.8.0
1640
+ */
1641
+ size(): number;
1642
+ }
1643
+ /**
1644
+ * Produce a {@link ContextValue} instance
1645
+ * @remarks Since 1.8.0
1646
+ * @public
1647
+ */
1648
+ declare function context(): Arbitrary<ContextValue>;
1649
+ //#endregion
1650
+ //#region src/arbitrary/date.d.ts
1651
+ /**
1652
+ * Constraints to be applied on {@link date}
1653
+ * @remarks Since 3.3.0
1654
+ * @public
1655
+ */
1656
+ interface DateConstraints {
1657
+ /**
1658
+ * Lower bound of the range (included)
1659
+ * @defaultValue new Date(-8640000000000000)
1660
+ * @remarks Since 1.17.0
1661
+ */
1662
+ min?: Date;
1663
+ /**
1664
+ * Upper bound of the range (included)
1665
+ * @defaultValue new Date(8640000000000000)
1666
+ * @remarks Since 1.17.0
1667
+ */
1668
+ max?: Date;
1669
+ /**
1670
+ * When set to true, no more "Invalid Date" can be generated.
1671
+ * @defaultValue false
1672
+ * @remarks Since 3.13.0
1673
+ */
1674
+ noInvalidDate?: boolean;
1675
+ }
1676
+ /**
1677
+ * For date between constraints.min or new Date(-8640000000000000) (included) and constraints.max or new Date(8640000000000000) (included)
1678
+ *
1679
+ * @param constraints - Constraints to apply when building instances
1680
+ *
1681
+ * @remarks Since 1.17.0
1682
+ * @public
1683
+ */
1684
+ declare function date(constraints?: DateConstraints): Arbitrary<Date>;
1685
+ //#endregion
1686
+ //#region src/arbitrary/clone.d.ts
1687
+ /**
1688
+ * Type of the value produced by {@link clone}
1689
+ * @remarks Since 2.5.0
1690
+ * @public
1691
+ */
1692
+ type CloneValue<T, N extends number, Rest extends T[] = []> = [number] extends [N] ? T[] : Rest["length"] extends N ? Rest : CloneValue<T, N, [T, ...Rest]>;
1693
+ /**
1694
+ * Clone the values generated by `arb` in order to produce fully equal values (might not be equal in terms of === or ==)
1695
+ *
1696
+ * @param arb - Source arbitrary
1697
+ * @param numValues - Number of values to produce
1698
+ *
1699
+ * @remarks Since 2.5.0
1700
+ * @public
1701
+ */
1702
+ declare function clone<T, N extends number>(arb: Arbitrary<T>, numValues: N): Arbitrary<CloneValue<T, N>>;
1703
+ //#endregion
1704
+ //#region src/arbitrary/dictionary.d.ts
1705
+ /**
1706
+ * Constraints to be applied on {@link dictionary}
1707
+ * @remarks Since 2.22.0
1708
+ * @public
1709
+ */
1710
+ interface DictionaryConstraints {
1711
+ /**
1712
+ * Lower bound for the number of keys defined into the generated instance
1713
+ * @defaultValue 0
1714
+ * @remarks Since 2.22.0
1715
+ */
1716
+ minKeys?: number;
1717
+ /**
1718
+ * Upper bound for the number of keys defined into the generated instance
1719
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
1720
+ * @remarks Since 2.22.0
1721
+ */
1722
+ maxKeys?: number;
1723
+ /**
1724
+ * Define how large the generated values should be (at max)
1725
+ * @remarks Since 2.22.0
1726
+ */
1727
+ size?: SizeForArbitrary;
1728
+ /**
1729
+ * Depth identifier can be used to share the current depth between several instances.
1730
+ *
1731
+ * By default, if not specified, each instance of dictionary will have its own depth.
1732
+ * In other words: you can have depth=1 in one while you have depth=100 in another one.
1733
+ *
1734
+ * @remarks Since 3.15.0
1735
+ */
1736
+ depthIdentifier?: DepthIdentifier | string;
1737
+ /**
1738
+ * Do not generate objects with null prototype
1739
+ * @defaultValue false
1740
+ * @remarks Since 3.13.0
1741
+ */
1742
+ noNullPrototype?: boolean;
1743
+ }
1744
+ /**
1745
+ * For dictionaries with keys produced by `keyArb` and values from `valueArb`
1746
+ *
1747
+ * @param keyArb - Arbitrary used to generate the keys of the object
1748
+ * @param valueArb - Arbitrary used to generate the values of the object
1749
+ *
1750
+ * @remarks Since 1.0.0
1751
+ * @public
1752
+ */
1753
+ declare function dictionary<T>(keyArb: Arbitrary<string>, valueArb: Arbitrary<T>, constraints?: DictionaryConstraints): Arbitrary<Record<string, T>>;
1754
+ /**
1755
+ * For dictionaries with keys produced by `keyArb` and values from `valueArb`
1756
+ *
1757
+ * @param keyArb - Arbitrary used to generate the keys of the object
1758
+ * @param valueArb - Arbitrary used to generate the values of the object
1759
+ *
1760
+ * @remarks Since 4.4.0
1761
+ * @public
1762
+ */
1763
+ declare function dictionary<K extends PropertyKey, V>(keyArb: Arbitrary<K>, valueArb: Arbitrary<V>, constraints?: DictionaryConstraints): Arbitrary<Record<K, V>>;
1764
+ //#endregion
1765
+ //#region src/arbitrary/emailAddress.d.ts
1766
+ /**
1767
+ * Constraints to be applied on {@link emailAddress}
1768
+ * @remarks Since 2.22.0
1769
+ * @public
1770
+ */
1771
+ interface EmailAddressConstraints {
1772
+ /**
1773
+ * Define how large the generated values should be (at max)
1774
+ * @remarks Since 2.22.0
1775
+ */
1776
+ size?: Exclude<SizeForArbitrary, "max">;
1777
+ }
1778
+ /**
1779
+ * For email address
1780
+ *
1781
+ * According to {@link https://www.ietf.org/rfc/rfc2821.txt | RFC 2821},
1782
+ * {@link https://www.ietf.org/rfc/rfc3696.txt | RFC 3696} and
1783
+ * {@link https://www.ietf.org/rfc/rfc5322.txt | RFC 5322}
1784
+ *
1785
+ * @param constraints - Constraints to apply when building instances (since 2.22.0)
1786
+ *
1787
+ * @remarks Since 1.14.0
1788
+ * @public
1789
+ */
1790
+ declare function emailAddress(constraints?: EmailAddressConstraints): Arbitrary<string>;
1791
+ //#endregion
1792
+ //#region src/arbitrary/double.d.ts
1793
+ /**
1794
+ * Constraints to be applied on {@link double}
1795
+ * @remarks Since 2.6.0
1796
+ * @public
1797
+ */
1798
+ interface DoubleConstraints {
1799
+ /**
1800
+ * Lower bound for the generated 64-bit floats (included, see minExcluded to exclude it)
1801
+ * @defaultValue Number.NEGATIVE_INFINITY, -1.7976931348623157e+308 when noDefaultInfinity is true
1802
+ * @remarks Since 2.8.0
1803
+ */
1804
+ min?: number;
1805
+ /**
1806
+ * Should the lower bound (aka min) be excluded?
1807
+ * Note: Excluding min=Number.NEGATIVE_INFINITY would result into having min set to -Number.MAX_VALUE.
1808
+ * @defaultValue false
1809
+ * @remarks Since 3.12.0
1810
+ */
1811
+ minExcluded?: boolean;
1812
+ /**
1813
+ * Upper bound for the generated 64-bit floats (included, see maxExcluded to exclude it)
1814
+ * @defaultValue Number.POSITIVE_INFINITY, 1.7976931348623157e+308 when noDefaultInfinity is true
1815
+ * @remarks Since 2.8.0
1816
+ */
1817
+ max?: number;
1818
+ /**
1819
+ * Should the upper bound (aka max) be excluded?
1820
+ * Note: Excluding max=Number.POSITIVE_INFINITY would result into having max set to Number.MAX_VALUE.
1821
+ * @defaultValue false
1822
+ * @remarks Since 3.12.0
1823
+ */
1824
+ maxExcluded?: boolean;
1825
+ /**
1826
+ * By default, lower and upper bounds are -infinity and +infinity.
1827
+ * By setting noDefaultInfinity to true, you move those defaults to minimal and maximal finite values.
1828
+ * @defaultValue false
1829
+ * @remarks Since 2.8.0
1830
+ */
1831
+ noDefaultInfinity?: boolean;
1832
+ /**
1833
+ * When set to true, no more Number.NaN can be generated.
1834
+ * @defaultValue false
1835
+ * @remarks Since 2.8.0
1836
+ */
1837
+ noNaN?: boolean;
1838
+ /**
1839
+ * When set to true, Number.isInteger(value) will be false for any generated value.
1840
+ * Note: -infinity and +infinity, or NaN can stil be generated except if you rejected them via another constraint.
1841
+ * @defaultValue false
1842
+ * @remarks Since 3.18.0
1843
+ */
1844
+ noInteger?: boolean;
1845
+ }
1846
+ /**
1847
+ * For 64-bit floating point numbers:
1848
+ * - sign: 1 bit
1849
+ * - significand: 52 bits
1850
+ * - exponent: 11 bits
1851
+ *
1852
+ * @param constraints - Constraints to apply when building instances (since 2.8.0)
1853
+ *
1854
+ * @remarks Since 0.0.6
1855
+ * @public
1856
+ */
1857
+ declare function double(constraints?: DoubleConstraints): Arbitrary<number>;
1858
+ //#endregion
1859
+ //#region src/arbitrary/float.d.ts
1860
+ /**
1861
+ * Constraints to be applied on {@link float}
1862
+ * @remarks Since 2.6.0
1863
+ * @public
1864
+ */
1865
+ interface FloatConstraints {
1866
+ /**
1867
+ * Lower bound for the generated 32-bit floats (included)
1868
+ * @defaultValue Number.NEGATIVE_INFINITY, -3.4028234663852886e+38 when noDefaultInfinity is true
1869
+ * @remarks Since 2.8.0
1870
+ */
1871
+ min?: number;
1872
+ /**
1873
+ * Should the lower bound (aka min) be excluded?
1874
+ * Note: Excluding min=Number.NEGATIVE_INFINITY would result into having min set to -3.4028234663852886e+38.
1875
+ * @defaultValue false
1876
+ * @remarks Since 3.12.0
1877
+ */
1878
+ minExcluded?: boolean;
1879
+ /**
1880
+ * Upper bound for the generated 32-bit floats (included)
1881
+ * @defaultValue Number.POSITIVE_INFINITY, 3.4028234663852886e+38 when noDefaultInfinity is true
1882
+ * @remarks Since 2.8.0
1883
+ */
1884
+ max?: number;
1885
+ /**
1886
+ * Should the upper bound (aka max) be excluded?
1887
+ * Note: Excluding max=Number.POSITIVE_INFINITY would result into having max set to 3.4028234663852886e+38.
1888
+ * @defaultValue false
1889
+ * @remarks Since 3.12.0
1890
+ */
1891
+ maxExcluded?: boolean;
1892
+ /**
1893
+ * By default, lower and upper bounds are -infinity and +infinity.
1894
+ * By setting noDefaultInfinity to true, you move those defaults to minimal and maximal finite values.
1895
+ * @defaultValue false
1896
+ * @remarks Since 2.8.0
1897
+ */
1898
+ noDefaultInfinity?: boolean;
1899
+ /**
1900
+ * When set to true, no more Number.NaN can be generated.
1901
+ * @defaultValue false
1902
+ * @remarks Since 2.8.0
1903
+ */
1904
+ noNaN?: boolean;
1905
+ /**
1906
+ * When set to true, Number.isInteger(value) will be false for any generated value.
1907
+ * Note: -infinity and +infinity, or NaN can stil be generated except if you rejected them via another constraint.
1908
+ * @defaultValue false
1909
+ * @remarks Since 3.18.0
1910
+ */
1911
+ noInteger?: boolean;
1912
+ }
1913
+ /**
1914
+ * For 32-bit floating point numbers:
1915
+ * - sign: 1 bit
1916
+ * - significand: 23 bits
1917
+ * - exponent: 8 bits
1918
+ *
1919
+ * The smallest non-zero value (in absolute value) that can be represented by such float is: 2 ** -126 * 2 ** -23.
1920
+ * And the largest one is: 2 ** 127 * (1 + (2 ** 23 - 1) / 2 ** 23).
1921
+ *
1922
+ * @param constraints - Constraints to apply when building instances (since 2.8.0)
1923
+ *
1924
+ * @remarks Since 0.0.6
1925
+ * @public
1926
+ */
1927
+ declare function float(constraints?: FloatConstraints): Arbitrary<number>;
1928
+ //#endregion
1929
+ //#region src/arbitrary/compareBooleanFunc.d.ts
1930
+ /**
1931
+ * For comparison boolean functions
1932
+ *
1933
+ * A comparison boolean function returns:
1934
+ * - `true` whenever `a < b`
1935
+ * - `false` otherwise (ie. `a = b` or `a > b`)
1936
+ *
1937
+ * @remarks Since 1.6.0
1938
+ * @public
1939
+ */
1940
+ declare function compareBooleanFunc<T>(): Arbitrary<(a: T, b: T) => boolean>;
1941
+ //#endregion
1942
+ //#region src/arbitrary/compareFunc.d.ts
1943
+ /**
1944
+ * For comparison functions
1945
+ *
1946
+ * A comparison function returns:
1947
+ * - negative value whenever `a < b`
1948
+ * - positive value whenever `a > b`
1949
+ * - zero whenever `a` and `b` are equivalent
1950
+ *
1951
+ * Comparison functions are transitive: `a < b and b < c => a < c`
1952
+ *
1953
+ * They also satisfy: `a < b <=> b > a` and `a = b <=> b = a`
1954
+ *
1955
+ * @remarks Since 1.6.0
1956
+ * @public
1957
+ */
1958
+ declare function compareFunc<T>(): Arbitrary<(a: T, b: T) => number>;
1959
+ //#endregion
1960
+ //#region src/arbitrary/func.d.ts
1961
+ /**
1962
+ * For pure functions
1963
+ *
1964
+ * @param arb - Arbitrary responsible to produce the values
1965
+ *
1966
+ * @remarks Since 1.6.0
1967
+ * @public
1968
+ */
1969
+ declare function func<TArgs extends any[], TOut>(arb: Arbitrary<TOut>): Arbitrary<(...args: TArgs) => TOut>;
1970
+ //#endregion
1971
+ //#region src/arbitrary/domain.d.ts
1972
+ /**
1973
+ * Constraints to be applied on {@link domain}
1974
+ * @remarks Since 2.22.0
1975
+ * @public
1976
+ */
1977
+ interface DomainConstraints {
1978
+ /**
1979
+ * Define how large the generated values should be (at max)
1980
+ * @remarks Since 2.22.0
1981
+ */
1982
+ size?: Exclude<SizeForArbitrary, "max">;
1983
+ }
1984
+ /**
1985
+ * For domains
1986
+ * having an extension with at least two lowercase characters
1987
+ *
1988
+ * According to {@link https://www.ietf.org/rfc/rfc1034.txt | RFC 1034},
1989
+ * {@link https://www.ietf.org/rfc/rfc1035.txt | RFC 1035},
1990
+ * {@link https://www.ietf.org/rfc/rfc1123.txt | RFC 1123} and
1991
+ * {@link https://url.spec.whatwg.org/ | WHATWG URL Standard}
1992
+ *
1993
+ * @param constraints - Constraints to apply when building instances (since 2.22.0)
1994
+ *
1995
+ * @remarks Since 1.14.0
1996
+ * @public
1997
+ */
1998
+ declare function domain(constraints?: DomainConstraints): Arbitrary<string>;
1999
+ //#endregion
2000
+ //#region src/arbitrary/integer.d.ts
2001
+ /**
2002
+ * Constraints to be applied on {@link integer}
2003
+ * @remarks Since 2.6.0
2004
+ * @public
2005
+ */
2006
+ interface IntegerConstraints {
2007
+ /**
2008
+ * Lower bound for the generated integers (included)
2009
+ * @defaultValue -0x80000000
2010
+ * @remarks Since 2.6.0
2011
+ */
2012
+ min?: number;
2013
+ /**
2014
+ * Upper bound for the generated integers (included)
2015
+ * @defaultValue 0x7fffffff
2016
+ * @remarks Since 2.6.0
2017
+ */
2018
+ max?: number;
2019
+ }
2020
+ /**
2021
+ * For integers between min (included) and max (included)
2022
+ *
2023
+ * @param constraints - Constraints to apply when building instances (since 2.6.0)
2024
+ *
2025
+ * @remarks Since 0.0.1
2026
+ * @public
2027
+ */
2028
+ declare function integer(constraints?: IntegerConstraints): Arbitrary<number>;
2029
+ //#endregion
2030
+ //#region src/arbitrary/maxSafeInteger.d.ts
2031
+ /**
2032
+ * For integers between Number.MIN_SAFE_INTEGER (included) and Number.MAX_SAFE_INTEGER (included)
2033
+ * @remarks Since 1.11.0
2034
+ * @public
2035
+ */
2036
+ declare function maxSafeInteger(): Arbitrary<number>;
2037
+ //#endregion
2038
+ //#region src/arbitrary/maxSafeNat.d.ts
2039
+ /**
2040
+ * For positive integers between 0 (included) and Number.MAX_SAFE_INTEGER (included)
2041
+ * @remarks Since 1.11.0
2042
+ * @public
2043
+ */
2044
+ declare function maxSafeNat(): Arbitrary<number>;
2045
+ //#endregion
2046
+ //#region src/arbitrary/nat.d.ts
2047
+ /**
2048
+ * Constraints to be applied on {@link nat}
2049
+ * @remarks Since 2.6.0
2050
+ * @public
2051
+ */
2052
+ interface NatConstraints {
2053
+ /**
2054
+ * Upper bound for the generated postive integers (included)
2055
+ * @defaultValue 0x7fffffff
2056
+ * @remarks Since 2.6.0
2057
+ */
2058
+ max?: number;
2059
+ }
2060
+ /**
2061
+ * For positive integers between 0 (included) and 2147483647 (included)
2062
+ * @remarks Since 0.0.1
2063
+ * @public
2064
+ */
2065
+ declare function nat(): Arbitrary<number>;
2066
+ /**
2067
+ * For positive integers between 0 (included) and max (included)
2068
+ *
2069
+ * @param max - Upper bound for the generated integers
2070
+ *
2071
+ * @remarks You may prefer to use `fc.nat({max})` instead.
2072
+ * @remarks Since 0.0.1
2073
+ * @public
2074
+ */
2075
+ declare function nat(max: number): Arbitrary<number>;
2076
+ /**
2077
+ * For positive integers between 0 (included) and max (included)
2078
+ *
2079
+ * @param constraints - Constraints to apply when building instances
2080
+ *
2081
+ * @remarks Since 2.6.0
2082
+ * @public
2083
+ */
2084
+ declare function nat(constraints: NatConstraints): Arbitrary<number>;
2085
+ /**
2086
+ * For positive integers between 0 (included) and max (included)
2087
+ *
2088
+ * @param arg - Either a maximum number or constraints to apply when building instances
2089
+ *
2090
+ * @remarks Since 2.6.0
2091
+ * @public
2092
+ */
2093
+ declare function nat(arg?: number | NatConstraints): Arbitrary<number>;
2094
+ //#endregion
2095
+ //#region src/arbitrary/ipV4.d.ts
2096
+ /**
2097
+ * For valid IP v4
2098
+ *
2099
+ * Following {@link https://tools.ietf.org/html/rfc3986#section-3.2.2 | RFC 3986}
2100
+ *
2101
+ * @remarks Since 1.14.0
2102
+ * @public
2103
+ */
2104
+ declare function ipV4(): Arbitrary<string>;
2105
+ //#endregion
2106
+ //#region src/arbitrary/ipV4Extended.d.ts
2107
+ /**
2108
+ * For valid IP v4 according to WhatWG
2109
+ *
2110
+ * Following {@link https://url.spec.whatwg.org/ | WhatWG}, the specification for web-browsers
2111
+ *
2112
+ * There is no equivalent for IP v6 according to the {@link https://url.spec.whatwg.org/#concept-ipv6-parser | IP v6 parser}
2113
+ *
2114
+ * @remarks Since 1.17.0
2115
+ * @public
2116
+ */
2117
+ declare function ipV4Extended(): Arbitrary<string>;
2118
+ //#endregion
2119
+ //#region src/arbitrary/ipV6.d.ts
2120
+ /**
2121
+ * For valid IP v6
2122
+ *
2123
+ * Following {@link https://tools.ietf.org/html/rfc3986#section-3.2.2 | RFC 3986}
2124
+ *
2125
+ * @remarks Since 1.14.0
2126
+ * @public
2127
+ */
2128
+ declare function ipV6(): Arbitrary<string>;
2129
+ //#endregion
2130
+ //#region src/arbitrary/letrec.d.ts
2131
+ /**
2132
+ * Type of the value produced by {@link letrec}
2133
+ * @remarks Since 3.0.0
2134
+ * @public
2135
+ */
2136
+ type LetrecValue<T> = { [K in keyof T]: Arbitrary<T[K]> };
2137
+ /**
2138
+ * Strongly typed type for the `tie` function passed by {@link letrec} to the `builder` function we pass to it.
2139
+ * You may want also want to use its loosely typed version {@link LetrecLooselyTypedTie}.
2140
+ *
2141
+ * @remarks Since 3.0.0
2142
+ * @public
2143
+ */
2144
+ interface LetrecTypedTie<T> {
2145
+ <K extends keyof T>(key: K): Arbitrary<T[K]>;
2146
+ (key: string): Arbitrary<unknown>;
2147
+ }
2148
+ /**
2149
+ * Strongly typed type for the `builder` function passed to {@link letrec}.
2150
+ * You may want also want to use its loosely typed version {@link LetrecLooselyTypedBuilder}.
2151
+ *
2152
+ * @remarks Since 3.0.0
2153
+ * @public
2154
+ */
2155
+ type LetrecTypedBuilder<T> = (tie: LetrecTypedTie<T>) => LetrecValue<T>;
2156
+ /**
2157
+ * Loosely typed type for the `tie` function passed by {@link letrec} to the `builder` function we pass to it.
2158
+ * You may want also want to use its strongly typed version {@link LetrecTypedTie}.
2159
+ *
2160
+ * @remarks Since 3.0.0
2161
+ * @public
2162
+ */
2163
+ type LetrecLooselyTypedTie = (key: string) => Arbitrary<unknown>;
2164
+ /**
2165
+ * Loosely typed type for the `builder` function passed to {@link letrec}.
2166
+ * You may want also want to use its strongly typed version {@link LetrecTypedBuilder}.
2167
+ *
2168
+ * @remarks Since 3.0.0
2169
+ * @public
2170
+ */
2171
+ type LetrecLooselyTypedBuilder<T> = (tie: LetrecLooselyTypedTie) => LetrecValue<T>;
2172
+ /**
2173
+ * For mutually recursive types
2174
+ *
2175
+ * @example
2176
+ * ```typescript
2177
+ * type Leaf = number;
2178
+ * type Node = [Tree, Tree];
2179
+ * type Tree = Node | Leaf;
2180
+ * const { tree } = fc.letrec<{ tree: Tree, node: Node, leaf: Leaf }>(tie => ({
2181
+ * tree: fc.oneof({depthSize: 'small'}, tie('leaf'), tie('node')),
2182
+ * node: fc.tuple(tie('tree'), tie('tree')),
2183
+ * leaf: fc.nat()
2184
+ * }));
2185
+ * // tree is 50% of node, 50% of leaf
2186
+ * // the ratio goes in favor of leaves as we go deeper in the tree (thanks to depthSize)
2187
+ * ```
2188
+ *
2189
+ * @param builder - Arbitraries builder based on themselves (through `tie`)
2190
+ *
2191
+ * @remarks Since 1.16.0
2192
+ * @public
2193
+ */
2194
+ declare function letrec<T>(builder: T extends Record<string, unknown> ? LetrecTypedBuilder<T> : never): LetrecValue<T>;
2195
+ /**
2196
+ * For mutually recursive types
2197
+ *
2198
+ * @example
2199
+ * ```typescript
2200
+ * const { tree } = fc.letrec(tie => ({
2201
+ * tree: fc.oneof({depthSize: 'small'}, tie('leaf'), tie('node')),
2202
+ * node: fc.tuple(tie('tree'), tie('tree')),
2203
+ * leaf: fc.nat()
2204
+ * }));
2205
+ * // tree is 50% of node, 50% of leaf
2206
+ * // the ratio goes in favor of leaves as we go deeper in the tree (thanks to depthSize)
2207
+ * ```
2208
+ *
2209
+ * @param builder - Arbitraries builder based on themselves (through `tie`)
2210
+ *
2211
+ * @remarks Since 1.16.0
2212
+ * @public
2213
+ */
2214
+ declare function letrec<T>(builder: LetrecLooselyTypedBuilder<T>): LetrecValue<T>;
2215
+ //#endregion
2216
+ //#region src/arbitrary/_internals/interfaces/EntityGraphTypes.d.ts
2217
+ /**
2218
+ * Defines the shape of a single entity type, where each field is associated with
2219
+ * an arbitrary that generates values for that field.
2220
+ *
2221
+ * @example
2222
+ * ```typescript
2223
+ * // Employee entity with firstName and lastName fields
2224
+ * { firstName: fc.string(), lastName: fc.string() }
2225
+ * ```
2226
+ *
2227
+ * @remarks Since 4.5.0
2228
+ * @public
2229
+ */
2230
+ type ArbitraryStructure<TFields> = { [TField in keyof TFields]: Arbitrary<TFields[TField]> };
2231
+ /**
2232
+ * Defines all entity types and their data fields for {@link entityGraph}.
2233
+ *
2234
+ * This is the first argument to {@link entityGraph} and specifies the non-relational properties
2235
+ * of each entity type. Each key is the name of an entity type and its value defines the
2236
+ * arbitraries for that entity.
2237
+ *
2238
+ * @example
2239
+ * ```typescript
2240
+ * {
2241
+ * employee: { name: fc.string(), age: fc.nat(100) },
2242
+ * team: { name: fc.string(), size: fc.nat(50) }
2243
+ * }
2244
+ * ```
2245
+ *
2246
+ * @remarks Since 4.5.0
2247
+ * @public
2248
+ */
2249
+ type Arbitraries<TEntityFields> = { [TEntityName in keyof TEntityFields]: ArbitraryStructure<TEntityFields[TEntityName]> };
2250
+ /**
2251
+ * Cardinality of a relationship between entities.
2252
+ *
2253
+ * Determines how many target entities can be referenced:
2254
+ * - `'0-1'`: Optional relationship — references zero or one target entity (value or undefined)
2255
+ * - `'1'`: Required relationship — always references exactly one target entity
2256
+ * - `'many'`: Multi-valued relationship — references an array of target entities (may be empty, no duplicates)
2257
+ * - `'inverse'`: Inverse relationship — automatically computed array of entities that reference this entity through a specified forward relationship
2258
+ *
2259
+ * @remarks Since 4.5.0
2260
+ * @public
2261
+ */
2262
+ type Arity = "0-1" | "1" | "many" | "inverse";
2263
+ /**
2264
+ * Defines restrictions on which entities can be targeted by a relationship.
2265
+ *
2266
+ * - `'any'`: No restrictions — any entity of the target type can be referenced
2267
+ * - `'exclusive'`: Each target entity can only be referenced by one relationship (prevents sharing)
2268
+ * - `'successor'`: Target must appear later in the entity list (prevents cycles)
2269
+ *
2270
+ * @defaultValue 'any'
2271
+ * @remarks Since 4.5.0
2272
+ * @public
2273
+ */
2274
+ type Strategy = "any" | "exclusive" | "successor";
2275
+ /**
2276
+ * Specifies a single relationship between entity types.
2277
+ *
2278
+ * A relationship defines how one entity type references another (or itself). This configuration
2279
+ * determines both the cardinality of the relationship and any restrictions on which entities
2280
+ * can be referenced.
2281
+ *
2282
+ * @example
2283
+ * ```typescript
2284
+ * // An employee has an optional manager who is also an employee
2285
+ * { arity: '0-1', type: 'employee', strategy: 'successor' }
2286
+ *
2287
+ * // A team has exactly one department
2288
+ * { arity: '1', type: 'department' }
2289
+ *
2290
+ * // An employee can have multiple competencies
2291
+ * { arity: 'many', type: 'competency' }
2292
+ * ```
2293
+ *
2294
+ * @remarks Since 4.5.0
2295
+ * @public
2296
+ */
2297
+ type Relationship<TTypeNames> = {
2298
+ /**
2299
+ * Cardinality of the relationship — determines how many target entities can be referenced.
2300
+ *
2301
+ * - `'0-1'`: Optional — produces undefined or a single instance of the target type
2302
+ * - `'1'`: Required — always produces a single instance of the target type
2303
+ * - `'many'`: Multi-valued — produces an array of target instances (may be empty, contains no duplicates)
2304
+ * - `'inverse'`: Inverse — automatically produces an array of entities that reference this entity via the specified forward relationship
2305
+ *
2306
+ * @remarks Since 4.5.0
2307
+ */
2308
+ arity: Arity;
2309
+ /**
2310
+ * The name of the entity type being referenced by this relationship.
2311
+ *
2312
+ * Must be one of the entity type names defined in the first argument to {@link entityGraph}.
2313
+ *
2314
+ * @remarks Since 4.5.0
2315
+ */
2316
+ type: TTypeNames;
2317
+ } & ({
2318
+ arity: Exclude<Arity, "inverse">;
2319
+ /**
2320
+ * Constrains which target entities are eligible to be referenced.
2321
+ *
2322
+ * - `'any'`: No restrictions — any entity of the target type can be selected
2323
+ * - `'exclusive'`: Each target can only be used once — prevents multiple relationships from referencing the same entity
2324
+ * - `'successor'`: Target must appear after the source in the entity array — prevents self-references and cycles
2325
+ *
2326
+ * @defaultValue 'any'
2327
+ * @remarks Since 4.5.0
2328
+ */
2329
+ strategy?: Strategy;
2330
+ } | {
2331
+ arity: "inverse";
2332
+ /**
2333
+ * Name of the forward relationship property in the target type that references this entity type.
2334
+ * The inverse relationship will contain all entities that reference this entity through that forward relationship.
2335
+ *
2336
+ * @example
2337
+ * ```typescript
2338
+ * // If 'employee' has 'team: { arity: "1", type: "team" }'
2339
+ * // Then 'team' can have 'members: { arity: "inverse", type: "employee", forwardRelationship: "team" }'
2340
+ * ```
2341
+ *
2342
+ * @remarks Since 4.5.0
2343
+ */
2344
+ forwardRelationship: string;
2345
+ });
2346
+ /**
2347
+ * Defines all relationships between entity types for {@link entityGraph}.
2348
+ *
2349
+ * This is the second argument to {@link entityGraph} and specifies how entities reference each other.
2350
+ * Each entity type can have zero or more relationship fields, where each field defines a link
2351
+ * to other entities.
2352
+ *
2353
+ * @example
2354
+ * ```typescript
2355
+ * {
2356
+ * employee: {
2357
+ * manager: { arity: '0-1', type: 'employee' },
2358
+ * team: { arity: '1', type: 'team' }
2359
+ * },
2360
+ * team: {}
2361
+ * }
2362
+ * ```
2363
+ *
2364
+ * @remarks Since 4.5.0
2365
+ * @public
2366
+ */
2367
+ type EntityRelations<TEntityFields> = { [TEntityName in keyof TEntityFields]: { [TField in string]: Relationship<keyof TEntityFields> } };
2368
+ type RelationsToValue<TRelations, TValues> = { [TField in keyof TRelations]: TRelations[TField] extends {
2369
+ arity: "0-1";
2370
+ type: infer TTypeName extends keyof TValues;
2371
+ } ? TValues[TTypeName] | undefined : TRelations[TField] extends {
2372
+ arity: "1";
2373
+ type: infer TTypeName extends keyof TValues;
2374
+ } ? TValues[TTypeName] : TRelations[TField] extends {
2375
+ arity: "many";
2376
+ type: infer TTypeName extends keyof TValues;
2377
+ } ? TValues[TTypeName][] : TRelations[TField] extends {
2378
+ arity: "inverse";
2379
+ type: infer TTypeName extends keyof TValues;
2380
+ } ? TValues[TTypeName][] : never };
2381
+ type Prettify$1<T> = { [K in keyof T]: T[K] } & {};
2382
+ type EntityGraphSingleValue<TEntityFields, TEntityRelations extends EntityRelations<TEntityFields>> = { [TEntityName in keyof TEntityFields]: Prettify$1<TEntityFields[TEntityName] & RelationsToValue<TEntityRelations[TEntityName], EntityGraphSingleValue<TEntityFields, TEntityRelations>>> };
2383
+ /**
2384
+ * Type of the values generated by {@link entityGraph}.
2385
+ *
2386
+ * The output is an object where each key is an entity type name and each value is an array
2387
+ * of entities of that type. Each entity contains both its data fields (from arbitraries) and
2388
+ * relationship fields (from relations), with relationships resolved to actual entity references.
2389
+ *
2390
+ * @remarks Since 4.5.0
2391
+ * @public
2392
+ */
2393
+ type EntityGraphValue<TEntityFields, TEntityRelations extends EntityRelations<TEntityFields>> = { [TEntityName in keyof EntityGraphSingleValue<TEntityFields, TEntityRelations>]: EntityGraphSingleValue<TEntityFields, TEntityRelations>[TEntityName][] };
2394
+ //#endregion
2395
+ //#region src/arbitrary/uniqueArray.d.ts
2396
+ /**
2397
+ * Shared constraints to be applied on {@link uniqueArray}
2398
+ * @remarks Since 2.23.0
2399
+ * @public
2400
+ */
2401
+ type UniqueArraySharedConstraints = {
2402
+ /**
2403
+ * Lower bound of the generated array size
2404
+ * @defaultValue 0
2405
+ * @remarks Since 2.23.0
2406
+ */
2407
+ minLength?: number;
2408
+ /**
2409
+ * Upper bound of the generated array size
2410
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
2411
+ * @remarks Since 2.23.0
2412
+ */
2413
+ maxLength?: number;
2414
+ /**
2415
+ * Define how large the generated values should be (at max)
2416
+ * @remarks Since 2.23.0
2417
+ */
2418
+ size?: SizeForArbitrary;
2419
+ /**
2420
+ * When receiving a depth identifier, the arbitrary will impact the depth
2421
+ * attached to it to avoid going too deep if it already generated lots of items.
2422
+ *
2423
+ * In other words, if the number of generated values within the collection is large
2424
+ * then the generated items will tend to be less deep to avoid creating structures a lot
2425
+ * larger than expected.
2426
+ *
2427
+ * For the moment, the depth is not taken into account to compute the number of items to
2428
+ * define for a precise generate call of the array. Just applied onto eligible items.
2429
+ *
2430
+ * @remarks Since 2.25.0
2431
+ */
2432
+ depthIdentifier?: DepthIdentifier | string;
2433
+ };
2434
+ /**
2435
+ * Constraints implying known and optimized comparison function
2436
+ * to be applied on {@link uniqueArray}
2437
+ *
2438
+ * @remarks Since 2.23.0
2439
+ * @public
2440
+ */
2441
+ type UniqueArrayConstraintsRecommended<T, U> = UniqueArraySharedConstraints & {
2442
+ /**
2443
+ * The operator to be used to compare the values after having applied the selector (if any):
2444
+ * - SameValue behaves like `Object.is` — {@link https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevalue}
2445
+ * - SameValueZero behaves like `Set` or `Map` — {@link https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero}
2446
+ * - IsStrictlyEqual behaves like `===` — {@link https://tc39.es/ecma262/multipage/abstract-operations.html#sec-isstrictlyequal}
2447
+ * - Fully custom comparison function: it implies performance costs for large arrays
2448
+ *
2449
+ * @defaultValue 'SameValue'
2450
+ * @remarks Since 2.23.0
2451
+ */
2452
+ comparator?: "SameValue" | "SameValueZero" | "IsStrictlyEqual";
2453
+ /**
2454
+ * How we should project the values before comparing them together
2455
+ * @defaultValue (v =&gt; v)
2456
+ * @remarks Since 2.23.0
2457
+ */
2458
+ selector?: (v: T) => U;
2459
+ };
2460
+ /**
2461
+ * Constraints implying a fully custom comparison function
2462
+ * to be applied on {@link uniqueArray}
2463
+ *
2464
+ * WARNING - Imply an extra performance cost whenever you want to generate large arrays
2465
+ *
2466
+ * @remarks Since 2.23.0
2467
+ * @public
2468
+ */
2469
+ type UniqueArrayConstraintsCustomCompare<T> = UniqueArraySharedConstraints & {
2470
+ /**
2471
+ * The operator to be used to compare the values after having applied the selector (if any)
2472
+ * @remarks Since 2.23.0
2473
+ */
2474
+ comparator: (a: T, b: T) => boolean;
2475
+ /**
2476
+ * How we should project the values before comparing them together
2477
+ * @remarks Since 2.23.0
2478
+ */
2479
+ selector?: undefined;
2480
+ };
2481
+ /**
2482
+ * Constraints implying fully custom comparison function and selector
2483
+ * to be applied on {@link uniqueArray}
2484
+ *
2485
+ * WARNING - Imply an extra performance cost whenever you want to generate large arrays
2486
+ *
2487
+ * @remarks Since 2.23.0
2488
+ * @public
2489
+ */
2490
+ type UniqueArrayConstraintsCustomCompareSelect<T, U> = UniqueArraySharedConstraints & {
2491
+ /**
2492
+ * The operator to be used to compare the values after having applied the selector (if any)
2493
+ * @remarks Since 2.23.0
2494
+ */
2495
+ comparator: (a: U, b: U) => boolean;
2496
+ /**
2497
+ * How we should project the values before comparing them together
2498
+ * @remarks Since 2.23.0
2499
+ */
2500
+ selector: (v: T) => U;
2501
+ };
2502
+ /**
2503
+ * Constraints implying known and optimized comparison function
2504
+ * to be applied on {@link uniqueArray}
2505
+ *
2506
+ * The defaults relies on the defaults specified by {@link UniqueArrayConstraintsRecommended}
2507
+ *
2508
+ * @remarks Since 2.23.0
2509
+ * @public
2510
+ */
2511
+ type UniqueArrayConstraints<T, U> = UniqueArrayConstraintsRecommended<T, U> | UniqueArrayConstraintsCustomCompare<T> | UniqueArrayConstraintsCustomCompareSelect<T, U>;
2512
+ /**
2513
+ * For arrays of unique values coming from `arb`
2514
+ *
2515
+ * @param arb - Arbitrary used to generate the values inside the array
2516
+ * @param constraints - Constraints to apply when building instances
2517
+ *
2518
+ * @remarks Since 2.23.0
2519
+ * @public
2520
+ */
2521
+ declare function uniqueArray<T, U>(arb: Arbitrary<T>, constraints?: UniqueArrayConstraintsRecommended<T, U>): Arbitrary<T[]>;
2522
+ /**
2523
+ * For arrays of unique values coming from `arb`
2524
+ *
2525
+ * @param arb - Arbitrary used to generate the values inside the array
2526
+ * @param constraints - Constraints to apply when building instances
2527
+ *
2528
+ * @remarks Since 2.23.0
2529
+ * @public
2530
+ */
2531
+ declare function uniqueArray<T>(arb: Arbitrary<T>, constraints: UniqueArrayConstraintsCustomCompare<T>): Arbitrary<T[]>;
2532
+ /**
2533
+ * For arrays of unique values coming from `arb`
2534
+ *
2535
+ * @param arb - Arbitrary used to generate the values inside the array
2536
+ * @param constraints - Constraints to apply when building instances
2537
+ *
2538
+ * @remarks Since 2.23.0
2539
+ * @public
2540
+ */
2541
+ declare function uniqueArray<T, U>(arb: Arbitrary<T>, constraints: UniqueArrayConstraintsCustomCompareSelect<T, U>): Arbitrary<T[]>;
2542
+ /**
2543
+ * For arrays of unique values coming from `arb`
2544
+ *
2545
+ * @param arb - Arbitrary used to generate the values inside the array
2546
+ * @param constraints - Constraints to apply when building instances
2547
+ *
2548
+ * @remarks Since 2.23.0
2549
+ * @public
2550
+ */
2551
+ declare function uniqueArray<T, U>(arb: Arbitrary<T>, constraints: UniqueArrayConstraints<T, U>): Arbitrary<T[]>;
2552
+ //#endregion
2553
+ //#region src/arbitrary/entityGraph.d.ts
2554
+ /**
2555
+ * Constraints to be applied on {@link entityGraph}
2556
+ * @remarks Since 4.5.0
2557
+ * @public
2558
+ */
2559
+ type EntityGraphContraints<TEntityFields> = {
2560
+ /**
2561
+ * Controls the minimum number of entities generated for each entity type in the initial pool.
2562
+ *
2563
+ * The initial pool defines the baseline set of entities that are created before any relationships
2564
+ * are established. Other entities may be created later to satisfy relationship requirements.
2565
+ *
2566
+ * @example
2567
+ * ```typescript
2568
+ * // Ensure at least 2 employees and at most 5 teams in the initial pool
2569
+ * // But possibly more than 5 teams at the end
2570
+ * { initialPoolConstraints: { employee: { minLength: 2 }, team: { maxLength: 5 } } }
2571
+ * ```
2572
+ *
2573
+ * @defaultValue When unspecified, defaults from {@link array} are used for each entity type
2574
+ * @remarks Since 4.5.0
2575
+ */
2576
+ initialPoolConstraints?: { [EntityName in keyof TEntityFields]?: ArrayConstraints };
2577
+ /**
2578
+ * Defines uniqueness criteria for entities of each type to prevent duplicate values.
2579
+ *
2580
+ * The selector function extracts a key from each entity. Entities with identical keys
2581
+ * (compared using `Object.is`) are considered duplicates and only one instance will be kept.
2582
+ *
2583
+ * @example
2584
+ * ```typescript
2585
+ * // Ensure employees have unique names
2586
+ * { unicityConstraints: { employee: (emp) => emp.name } }
2587
+ * ```
2588
+ *
2589
+ * @defaultValue All entities are considered unique (no deduplication is performed)
2590
+ * @remarks Since 4.5.0
2591
+ */
2592
+ unicityConstraints?: { [EntityName in keyof TEntityFields]?: UniqueArrayConstraintsRecommended<TEntityFields[EntityName], unknown>["selector"] };
2593
+ /**
2594
+ * Do not generate values with null prototype
2595
+ * @defaultValue false
2596
+ * @remarks Since 4.5.0
2597
+ */
2598
+ noNullPrototype?: boolean;
2599
+ };
2600
+ /**
2601
+ * Generates interconnected entities with relationships based on a schema definition.
2602
+ *
2603
+ * This arbitrary creates structured data where entities can reference each other through defined
2604
+ * relationships. The generated values automatically include links between entities, making it
2605
+ * ideal for testing graph structures, relational data, or interconnected object models.
2606
+ *
2607
+ * The output is an object where each key corresponds to an entity type and the value is an array
2608
+ * of entities of that type. Entities contain both their data fields and relationship links.
2609
+ *
2610
+ * @example
2611
+ * ```typescript
2612
+ * // Generate a simple directed graph where nodes link to other nodes
2613
+ * fc.entityGraph(
2614
+ * { node: { id: fc.stringMatching(/^[A-Z][a-z]*$/) } },
2615
+ * { node: { linkTo: { arity: 'many', type: 'node' } } },
2616
+ * )
2617
+ * // Produces: { node: [{ id: "Abc", linkTo: [<node#1>, <node#0>] }, ...] }
2618
+ * ```
2619
+ *
2620
+ * @example
2621
+ * ```typescript
2622
+ * // Generate employees with managers and teams
2623
+ * fc.entityGraph(
2624
+ * {
2625
+ * employee: { name: fc.string() },
2626
+ * team: { name: fc.string() }
2627
+ * },
2628
+ * {
2629
+ * employee: {
2630
+ * manager: { arity: '0-1', type: 'employee' }, // Optional manager
2631
+ * team: { arity: '1', type: 'team' } // Required team
2632
+ * },
2633
+ * team: {}
2634
+ * }
2635
+ * )
2636
+ * ```
2637
+ *
2638
+ * @param arbitraries - Defines the data fields for each entity type (non-relational properties)
2639
+ * @param relations - Defines how entities reference each other (relational properties)
2640
+ * @param constraints - Optional configuration to customize generation behavior
2641
+ *
2642
+ * @remarks Since 4.5.0
2643
+ * @public
2644
+ */
2645
+ declare function entityGraph<TEntityFields, TEntityRelations extends EntityRelations<TEntityFields>>(arbitraries: Arbitraries<TEntityFields>, relations: TEntityRelations, constraints?: EntityGraphContraints<TEntityFields>): Arbitrary<EntityGraphValue<TEntityFields, TEntityRelations>>;
2646
+ //#endregion
2647
+ //#region src/arbitrary/lorem.d.ts
2648
+ /**
2649
+ * Constraints to be applied on {@link lorem}
2650
+ * @remarks Since 2.5.0
2651
+ * @public
2652
+ */
2653
+ interface LoremConstraints {
2654
+ /**
2655
+ * Maximal number of entities:
2656
+ * - maximal number of words in case mode is 'words'
2657
+ * - maximal number of sentences in case mode is 'sentences'
2658
+ *
2659
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
2660
+ * @remarks Since 2.5.0
2661
+ */
2662
+ maxCount?: number;
2663
+ /**
2664
+ * Type of strings that should be produced by {@link lorem}:
2665
+ * - words: multiple words
2666
+ * - sentences: multiple sentences
2667
+ *
2668
+ * @defaultValue 'words'
2669
+ * @remarks Since 2.5.0
2670
+ */
2671
+ mode?: "words" | "sentences";
2672
+ /**
2673
+ * Define how large the generated values should be (at max)
2674
+ * @remarks Since 2.22.0
2675
+ */
2676
+ size?: SizeForArbitrary;
2677
+ }
2678
+ /**
2679
+ * For lorem ipsum string of words or sentences with maximal number of words or sentences
2680
+ *
2681
+ * @param constraints - Constraints to be applied onto the generated value (since 2.5.0)
2682
+ *
2683
+ * @remarks Since 0.0.1
2684
+ * @public
2685
+ */
2686
+ declare function lorem(constraints?: LoremConstraints): Arbitrary<string>;
2687
+ //#endregion
2688
+ //#region src/arbitrary/map.d.ts
2689
+ /**
2690
+ * Constraints to be applied on {@link map}
2691
+ * @remarks Since 4.4.0
2692
+ * @public
2693
+ */
2694
+ interface MapConstraints {
2695
+ /**
2696
+ * Lower bound for the number of entries defined into the generated instance
2697
+ * @defaultValue 0
2698
+ * @remarks Since 4.4.0
2699
+ */
2700
+ minKeys?: number;
2701
+ /**
2702
+ * Upper bound for the number of entries defined into the generated instance
2703
+ * @defaultValue 0x7fffffff
2704
+ * @remarks Since 4.4.0
2705
+ */
2706
+ maxKeys?: number;
2707
+ /**
2708
+ * Define how large the generated values should be (at max)
2709
+ * @remarks Since 4.4.0
2710
+ */
2711
+ size?: SizeForArbitrary;
2712
+ /**
2713
+ * Depth identifier can be used to share the current depth between several instances.
2714
+ *
2715
+ * By default, if not specified, each instance of map will have its own depth.
2716
+ * In other words: you can have depth=1 in one while you have depth=100 in another one.
2717
+ *
2718
+ * @remarks Since 4.4.0
2719
+ */
2720
+ depthIdentifier?: DepthIdentifier | string;
2721
+ }
2722
+ /**
2723
+ * For Maps with keys produced by `keyArb` and values from `valueArb`
2724
+ *
2725
+ * @param keyArb - Arbitrary used to generate the keys of the Map
2726
+ * @param valueArb - Arbitrary used to generate the values of the Map
2727
+ * @param constraints - Constraints to apply when building instances
2728
+ *
2729
+ * @remarks Since 4.4.0
2730
+ * @public
2731
+ */
2732
+ declare function map<K, V>(keyArb: Arbitrary<K>, valueArb: Arbitrary<V>, constraints?: MapConstraints): Arbitrary<Map<K, V>>;
2733
+ //#endregion
2734
+ //#region src/arbitrary/mapToConstant.d.ts
2735
+ /**
2736
+ * Generate non-contiguous ranges of values
2737
+ * by mapping integer values to constant
2738
+ *
2739
+ * @param options - Builders to be called to generate the values
2740
+ *
2741
+ * @example
2742
+ * ```
2743
+ * // generate alphanumeric values (a-z0-9)
2744
+ * mapToConstant(
2745
+ * { num: 26, build: v => String.fromCharCode(v + 0x61) },
2746
+ * { num: 10, build: v => String.fromCharCode(v + 0x30) },
2747
+ * )
2748
+ * ```
2749
+ *
2750
+ * @remarks Since 1.14.0
2751
+ * @public
2752
+ */
2753
+ declare function mapToConstant<T>(...entries: {
2754
+ num: number;
2755
+ build: (idInGroup: number) => T;
2756
+ }[]): Arbitrary<T>;
2757
+ //#endregion
2758
+ //#region src/arbitrary/memo.d.ts
2759
+ /**
2760
+ * Output type for {@link memo}
2761
+ * @remarks Since 1.16.0
2762
+ * @public
2763
+ */
2764
+ type Memo<T> = (maxDepth?: number) => Arbitrary<T>;
2765
+ /**
2766
+ * For mutually recursive types
2767
+ *
2768
+ * @example
2769
+ * ```typescript
2770
+ * // tree is 1 / 3 of node, 2 / 3 of leaf
2771
+ * const tree: fc.Memo<Tree> = fc.memo(n => fc.oneof(node(n), leaf(), leaf()));
2772
+ * const node: fc.Memo<Tree> = fc.memo(n => {
2773
+ * if (n <= 1) return fc.record({ left: leaf(), right: leaf() });
2774
+ * return fc.record({ left: tree(), right: tree() }); // tree() is equivalent to tree(n-1)
2775
+ * });
2776
+ * const leaf = fc.nat;
2777
+ * ```
2778
+ *
2779
+ * @param builder - Arbitrary builder taken the maximal depth allowed as input (parameter `n`)
2780
+ *
2781
+ * @remarks Since 1.16.0
2782
+ * @public
2783
+ */
2784
+ declare function memo<T>(builder: (maxDepth: number) => Arbitrary<T>): Memo<T>;
2785
+ //#endregion
2786
+ //#region src/arbitrary/mixedCase.d.ts
2787
+ /**
2788
+ * Constraints to be applied on {@link mixedCase}
2789
+ * @remarks Since 1.17.0
2790
+ * @public
2791
+ */
2792
+ interface MixedCaseConstraints {
2793
+ /**
2794
+ * Transform a character to its upper and/or lower case version
2795
+ * @defaultValue try `toUpperCase` on the received code-point, if no effect try `toLowerCase`
2796
+ * @remarks Since 1.17.0
2797
+ */
2798
+ toggleCase?: (rawChar: string) => string;
2799
+ /**
2800
+ * In order to be fully reversable (only in case you want to shrink user definable values)
2801
+ * you should provide a function taking a string containing possibly toggled items and returning its
2802
+ * untoggled version.
2803
+ */
2804
+ untoggleAll?: (toggledString: string) => string;
2805
+ }
2806
+ /**
2807
+ * Randomly switch the case of characters generated by `stringArb` (upper/lower)
2808
+ *
2809
+ * WARNING:
2810
+ * Require bigint support.
2811
+ * Under-the-hood the arbitrary relies on bigint to compute the flags that should be toggled or not.
2812
+ *
2813
+ * @param stringArb - Arbitrary able to build string values
2814
+ * @param constraints - Constraints to be applied when computing upper/lower case version
2815
+ *
2816
+ * @remarks Since 1.17.0
2817
+ * @public
2818
+ */
2819
+ declare function mixedCase(stringArb: Arbitrary<string>, constraints?: MixedCaseConstraints): Arbitrary<string>;
2820
+ //#endregion
2821
+ //#region src/arbitrary/_shared/StringSharedConstraints.d.ts
2822
+ /**
2823
+ * Constraints to be applied on arbitraries for strings
2824
+ * @remarks Since 2.4.0
2825
+ * @public
2826
+ */
2827
+ interface StringSharedConstraints {
2828
+ /**
2829
+ * Lower bound of the generated string length (included)
2830
+ * @defaultValue 0
2831
+ * @remarks Since 2.4.0
2832
+ */
2833
+ minLength?: number;
2834
+ /**
2835
+ * Upper bound of the generated string length (included)
2836
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
2837
+ * @remarks Since 2.4.0
2838
+ */
2839
+ maxLength?: number;
2840
+ /**
2841
+ * Define how large the generated values should be (at max)
2842
+ * @remarks Since 2.22.0
2843
+ */
2844
+ size?: SizeForArbitrary;
2845
+ }
2846
+ //#endregion
2847
+ //#region src/arbitrary/string.d.ts
2848
+ /**
2849
+ * Constraints to be applied on arbitrary {@link string}
2850
+ * @remarks Since 3.22.0
2851
+ * @public
2852
+ */
2853
+ type StringConstraints = StringSharedConstraints & {
2854
+ /**
2855
+ * A string results from the join between several unitary strings produced by the Arbitrary instance defined by `unit`.
2856
+ * The `minLength` and `maxLength` refers to the number of these units composing the string. In other words it does not have to be confound with `.length` on an instance of string.
2857
+ *
2858
+ * A unit can either be a fully custom Arbitrary or one of the pre-defined options:
2859
+ * - `'grapheme'` - Any printable grapheme as defined by the Unicode standard. This unit includes graphemes that may:
2860
+ * - Span multiple code points (e.g., `'\u{0061}\u{0300}'`)
2861
+ * - Consist of multiple characters (e.g., `'\u{1f431}'`)
2862
+ * - Include non-European and non-ASCII characters.
2863
+ * - **Note:** Graphemes produced by this unit are designed to remain visually distinct when joined together.
2864
+ * - **Note:** We are relying on the specifications of Unicode 15.
2865
+ * - `'grapheme-composite'` - Any printable grapheme limited to a single code point. This option produces graphemes limited to a single code point.
2866
+ * - **Note:** Graphemes produced by this unit are designed to remain visually distinct when joined together.
2867
+ * - **Note:** We are relying on the specifications of Unicode 15.
2868
+ * - `'grapheme-ascii'` - Any printable ASCII character.
2869
+ * - `'binary'` - Any possible code point (except half surrogate pairs), regardless of how it may combine with subsequent code points in the produced string. This unit produces a single code point within the full Unicode range (0000-10FFFF).
2870
+ * - `'binary-ascii'` - Any possible ASCII character, including control characters. This unit produces any code point in the range 0000-00FF.
2871
+ *
2872
+ * @defaultValue 'grapheme-ascii'
2873
+ * @remarks Since 3.22.0
2874
+ */
2875
+ unit?: "grapheme" | "grapheme-composite" | "grapheme-ascii" | "binary" | "binary-ascii" | Arbitrary<string>;
2876
+ };
2877
+ /**
2878
+ * For strings of {@link char}
2879
+ *
2880
+ * @param constraints - Constraints to apply when building instances (since 2.4.0)
2881
+ *
2882
+ * @remarks Since 0.0.1
2883
+ * @public
2884
+ */
2885
+ declare function string(constraints?: StringConstraints): Arbitrary<string>;
2886
+ //#endregion
2887
+ //#region src/arbitrary/_internals/helpers/QualifiedObjectConstraints.d.ts
2888
+ /**
2889
+ * Constraints for {@link anything} and {@link object}
2890
+ * @public
2891
+ */
2892
+ interface ObjectConstraints {
2893
+ /**
2894
+ * Limit the depth of the object by increasing the probability to generate simple values (defined via values)
2895
+ * as we go deeper in the object.
2896
+ * @remarks Since 2.20.0
2897
+ */
2898
+ depthSize?: DepthSize;
2899
+ /**
2900
+ * Maximal depth allowed
2901
+ * @defaultValue Number.POSITIVE_INFINITY — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
2902
+ * @remarks Since 0.0.7
2903
+ */
2904
+ maxDepth?: number;
2905
+ /**
2906
+ * Maximal number of keys
2907
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
2908
+ * @remarks Since 1.13.0
2909
+ */
2910
+ maxKeys?: number;
2911
+ /**
2912
+ * Define how large the generated values should be (at max)
2913
+ * @remarks Since 2.22.0
2914
+ */
2915
+ size?: SizeForArbitrary;
2916
+ /**
2917
+ * Arbitrary for keys
2918
+ * @defaultValue {@link string}
2919
+ * @remarks Since 0.0.7
2920
+ */
2921
+ key?: Arbitrary<string>;
2922
+ /**
2923
+ * Arbitrary for values
2924
+ * @defaultValue {@link boolean}, {@link integer}, {@link double}, {@link string}, null, undefined, Number.NaN, +0, -0, Number.EPSILON, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY
2925
+ * @remarks Since 0.0.7
2926
+ */
2927
+ values?: Arbitrary<unknown>[];
2928
+ /**
2929
+ * Also generate boxed versions of values
2930
+ * @defaultValue false
2931
+ * @remarks Since 1.11.0
2932
+ */
2933
+ withBoxedValues?: boolean;
2934
+ /**
2935
+ * Also generate Set
2936
+ * @defaultValue false
2937
+ * @remarks Since 1.11.0
2938
+ */
2939
+ withSet?: boolean;
2940
+ /**
2941
+ * Also generate Map
2942
+ * @defaultValue false
2943
+ * @remarks Since 1.11.0
2944
+ */
2945
+ withMap?: boolean;
2946
+ /**
2947
+ * Also generate string representations of object instances
2948
+ * @defaultValue false
2949
+ * @remarks Since 1.17.0
2950
+ */
2951
+ withObjectString?: boolean;
2952
+ /**
2953
+ * Also generate object with null prototype
2954
+ * @defaultValue false
2955
+ * @remarks Since 1.23.0
2956
+ */
2957
+ withNullPrototype?: boolean;
2958
+ /**
2959
+ * Also generate BigInt
2960
+ * @defaultValue false
2961
+ * @remarks Since 1.26.0
2962
+ */
2963
+ withBigInt?: boolean;
2964
+ /**
2965
+ * Also generate Date
2966
+ * @defaultValue false
2967
+ * @remarks Since 2.5.0
2968
+ */
2969
+ withDate?: boolean;
2970
+ /**
2971
+ * Also generate typed arrays in: (Uint|Int)(8|16|32)Array and Float(32|64)Array
2972
+ * Remark: no typed arrays made of bigint
2973
+ * @defaultValue false
2974
+ * @remarks Since 2.9.0
2975
+ */
2976
+ withTypedArray?: boolean;
2977
+ /**
2978
+ * Also generate sparse arrays (arrays with holes)
2979
+ * @defaultValue false
2980
+ * @remarks Since 2.13.0
2981
+ */
2982
+ withSparseArray?: boolean;
2983
+ /**
2984
+ * Replace the arbitrary of strings defaulted for key and values by one able to generate unicode strings with non-ascii characters.
2985
+ * If you override key and/or values constraint, this flag will not apply to your override.
2986
+ * @deprecated Prefer using `stringUnit` to customize the kind of strings that will be generated by default.
2987
+ * @defaultValue false
2988
+ * @remarks Since 3.19.0
2989
+ */
2990
+ withUnicodeString?: boolean;
2991
+ /**
2992
+ * Replace the default unit for strings.
2993
+ * @defaultValue undefined
2994
+ * @remarks Since 3.23.0
2995
+ */
2996
+ stringUnit?: StringConstraints["unit"];
2997
+ }
2998
+ //#endregion
2999
+ //#region src/arbitrary/object.d.ts
3000
+ /**
3001
+ * For any objects
3002
+ *
3003
+ * You may use {@link sample} to preview the values that will be generated
3004
+ *
3005
+ * @example
3006
+ * ```javascript
3007
+ * {}, {k: [{}, 1, 2]}
3008
+ * ```
3009
+ *
3010
+ * @remarks Since 0.0.7
3011
+ * @public
3012
+ */
3013
+ declare function object(): Arbitrary<Record<string, unknown>>;
3014
+ /**
3015
+ * For any objects following the constraints defined by `settings`
3016
+ *
3017
+ * You may use {@link sample} to preview the values that will be generated
3018
+ *
3019
+ * @example
3020
+ * ```javascript
3021
+ * {}, {k: [{}, 1, 2]}
3022
+ * ```
3023
+ *
3024
+ * @param constraints - Constraints to apply when building instances
3025
+ *
3026
+ * @remarks Since 0.0.7
3027
+ * @public
3028
+ */
3029
+ declare function object(constraints: ObjectConstraints): Arbitrary<Record<string, unknown>>;
3030
+ //#endregion
3031
+ //#region src/arbitrary/_internals/helpers/JsonConstraintsBuilder.d.ts
3032
+ /**
3033
+ * Shared constraints for:
3034
+ * - {@link json},
3035
+ * - {@link jsonValue},
3036
+ *
3037
+ * @remarks Since 2.5.0
3038
+ * @public
3039
+ */
3040
+ interface JsonSharedConstraints {
3041
+ /**
3042
+ * Limit the depth of the object by increasing the probability to generate simple values (defined via values)
3043
+ * as we go deeper in the object.
3044
+ *
3045
+ * @remarks Since 2.20.0
3046
+ */
3047
+ depthSize?: DepthSize;
3048
+ /**
3049
+ * Maximal depth allowed
3050
+ * @defaultValue Number.POSITIVE_INFINITY — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
3051
+ * @remarks Since 2.5.0
3052
+ */
3053
+ maxDepth?: number;
3054
+ /**
3055
+ * Only generate instances having keys and values made of ascii strings (when true)
3056
+ * @deprecated Prefer using `stringUnit` to customize the kind of strings that will be generated by default.
3057
+ * @defaultValue true
3058
+ * @remarks Since 3.19.0
3059
+ */
3060
+ noUnicodeString?: boolean;
3061
+ /**
3062
+ * Replace the default unit for strings.
3063
+ * @defaultValue undefined
3064
+ * @remarks Since 3.23.0
3065
+ */
3066
+ stringUnit?: StringConstraints["unit"];
3067
+ }
3068
+ /**
3069
+ * Typings for a Json array
3070
+ * @remarks Since 2.20.0
3071
+ * @public
3072
+ */
3073
+ type JsonArray = Array<JsonValue>;
3074
+ /**
3075
+ * Typings for a Json object
3076
+ * @remarks Since 2.20.0
3077
+ * @public
3078
+ */
3079
+ type JsonObject = { [key in string]?: JsonValue };
3080
+ /**
3081
+ * Typings for a Json value
3082
+ * @remarks Since 2.20.0
3083
+ * @public
3084
+ */
3085
+ type JsonValue = boolean | number | string | null | JsonArray | JsonObject;
3086
+ //#endregion
3087
+ //#region src/arbitrary/json.d.ts
3088
+ /**
3089
+ * For any JSON strings
3090
+ *
3091
+ * Keys and string values rely on {@link string}
3092
+ *
3093
+ * @param constraints - Constraints to be applied onto the generated instance (since 2.5.0)
3094
+ *
3095
+ * @remarks Since 0.0.7
3096
+ * @public
3097
+ */
3098
+ declare function json(constraints?: JsonSharedConstraints): Arbitrary<string>;
3099
+ //#endregion
3100
+ //#region src/arbitrary/anything.d.ts
3101
+ /**
3102
+ * For any type of values
3103
+ *
3104
+ * You may use {@link sample} to preview the values that will be generated
3105
+ *
3106
+ * @example
3107
+ * ```javascript
3108
+ * null, undefined, 42, 6.5, 'Hello', {}, {k: [{}, 1, 2]}
3109
+ * ```
3110
+ *
3111
+ * @remarks Since 0.0.7
3112
+ * @public
3113
+ */
3114
+ declare function anything(): Arbitrary<unknown>;
3115
+ /**
3116
+ * For any type of values following the constraints defined by `settings`
3117
+ *
3118
+ * You may use {@link sample} to preview the values that will be generated
3119
+ *
3120
+ * @example
3121
+ * ```javascript
3122
+ * null, undefined, 42, 6.5, 'Hello', {}, {k: [{}, 1, 2]}
3123
+ * ```
3124
+ *
3125
+ * @example
3126
+ * ```typescript
3127
+ * // Using custom settings
3128
+ * fc.anything({
3129
+ * key: fc.string(),
3130
+ * values: [fc.integer(10,20), fc.constant(42)],
3131
+ * maxDepth: 2
3132
+ * });
3133
+ * // Can build entries such as:
3134
+ * // - 19
3135
+ * // - [{"2":12,"k":15,"A":42}]
3136
+ * // - {"4":[19,13,14,14,42,11,20,11],"6":42,"7":16,"L":10,"'":[20,11],"e":[42,20,42,14,13,17]}
3137
+ * // - [42,42,42]...
3138
+ * ```
3139
+ *
3140
+ * @param constraints - Constraints to apply when building instances
3141
+ *
3142
+ * @remarks Since 0.0.7
3143
+ * @public
3144
+ */
3145
+ declare function anything(constraints: ObjectConstraints): Arbitrary<unknown>;
3146
+ //#endregion
3147
+ //#region src/arbitrary/jsonValue.d.ts
3148
+ /**
3149
+ * For any JSON compliant values
3150
+ *
3151
+ * Keys and string values rely on {@link string}
3152
+ *
3153
+ * As `JSON.parse` preserves `-0`, `jsonValue` can also have `-0` as a value.
3154
+ * `jsonValue` must be seen as: any value that could have been built by doing a `JSON.parse` on a given string.
3155
+ *
3156
+ * @param constraints - Constraints to be applied onto the generated instance
3157
+ *
3158
+ * @remarks Since 2.20.0
3159
+ * @public
3160
+ */
3161
+ declare function jsonValue(constraints?: JsonSharedConstraints): Arbitrary<JsonValue>;
3162
+ //#endregion
3163
+ //#region src/arbitrary/oneof.d.ts
3164
+ /**
3165
+ * Conjonction of a weight and an arbitrary used by {@link oneof}
3166
+ * in order to generate values
3167
+ *
3168
+ * @remarks Since 1.18.0
3169
+ * @public
3170
+ */
3171
+ interface WeightedArbitrary<T> {
3172
+ /**
3173
+ * Weight to be applied when selecting which arbitrary should be used
3174
+ * @remarks Since 0.0.7
3175
+ */
3176
+ weight: number;
3177
+ /**
3178
+ * Instance of Arbitrary
3179
+ * @remarks Since 0.0.7
3180
+ */
3181
+ arbitrary: Arbitrary<T>;
3182
+ }
3183
+ /**
3184
+ * Either an `Arbitrary<T>` or a `WeightedArbitrary<T>`
3185
+ * @remarks Since 3.0.0
3186
+ * @public
3187
+ */
3188
+ type MaybeWeightedArbitrary<T> = Arbitrary<T> | WeightedArbitrary<T>;
3189
+ /**
3190
+ * Infer the type of the Arbitrary produced by {@link oneof}
3191
+ * given the type of the source arbitraries
3192
+ *
3193
+ * @remarks Since 2.2.0
3194
+ * @public
3195
+ */
3196
+ type OneOfValue<Ts extends MaybeWeightedArbitrary<unknown>[]> = { [K in keyof Ts]: Ts[K] extends MaybeWeightedArbitrary<infer U> ? U : never }[number];
3197
+ /**
3198
+ * Constraints to be applied on {@link oneof}
3199
+ * @remarks Since 2.14.0
3200
+ * @public
3201
+ */
3202
+ type OneOfConstraints = {
3203
+ /**
3204
+ * When set to true, the shrinker of oneof will try to check if the first arbitrary
3205
+ * could have been used to discover an issue. It allows to shrink trees.
3206
+ *
3207
+ * Warning: First arbitrary must be the one resulting in the smallest structures
3208
+ * for usages in deep tree-like structures.
3209
+ *
3210
+ * @defaultValue false
3211
+ * @remarks Since 2.14.0
3212
+ */
3213
+ withCrossShrink?: boolean;
3214
+ /**
3215
+ * While going deeper and deeper within a recursive structure (see {@link letrec}),
3216
+ * this factor will be used to increase the probability to generate instances
3217
+ * of the first passed arbitrary.
3218
+ *
3219
+ * @remarks Since 2.14.0
3220
+ */
3221
+ depthSize?: DepthSize;
3222
+ /**
3223
+ * Maximal authorized depth.
3224
+ * Once this depth has been reached only the first arbitrary will be used.
3225
+ *
3226
+ * @defaultValue Number.POSITIVE_INFINITY — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
3227
+ * @remarks Since 2.14.0
3228
+ */
3229
+ maxDepth?: number;
3230
+ /**
3231
+ * Depth identifier can be used to share the current depth between several instances.
3232
+ *
3233
+ * By default, if not specified, each instance of oneof will have its own depth.
3234
+ * In other words: you can have depth=1 in one while you have depth=100 in another one.
3235
+ *
3236
+ * @remarks Since 2.14.0
3237
+ */
3238
+ depthIdentifier?: DepthIdentifier | string;
3239
+ };
3240
+ /**
3241
+ * For one of the values generated by `...arbs` - with all `...arbs` equiprobable
3242
+ *
3243
+ * **WARNING**: It expects at least one arbitrary
3244
+ *
3245
+ * @param arbs - Arbitraries that might be called to produce a value
3246
+ *
3247
+ * @remarks Since 0.0.1
3248
+ * @public
3249
+ */
3250
+ declare function oneof<Ts extends MaybeWeightedArbitrary<unknown>[]>(...arbs: Ts): Arbitrary<OneOfValue<Ts>>;
3251
+ /**
3252
+ * For one of the values generated by `...arbs` - with all `...arbs` equiprobable
3253
+ *
3254
+ * **WARNING**: It expects at least one arbitrary
3255
+ *
3256
+ * @param constraints - Constraints to be applied when generating the values
3257
+ * @param arbs - Arbitraries that might be called to produce a value
3258
+ *
3259
+ * @remarks Since 2.14.0
3260
+ * @public
3261
+ */
3262
+ declare function oneof<Ts extends MaybeWeightedArbitrary<unknown>[]>(constraints: OneOfConstraints, ...arbs: Ts): Arbitrary<OneOfValue<Ts>>;
3263
+ //#endregion
3264
+ //#region src/arbitrary/option.d.ts
3265
+ /**
3266
+ * Constraints to be applied on {@link option}
3267
+ * @remarks Since 2.2.0
3268
+ * @public
3269
+ */
3270
+ interface OptionConstraints<TNil = null> {
3271
+ /**
3272
+ * The probability to build a nil value is of `1 / freq`.
3273
+ * @defaultValue 6
3274
+ * @remarks Since 1.17.0
3275
+ */
3276
+ freq?: number;
3277
+ /**
3278
+ * The nil value
3279
+ * @defaultValue null
3280
+ * @remarks Since 1.17.0
3281
+ */
3282
+ nil?: TNil;
3283
+ /**
3284
+ * While going deeper and deeper within a recursive structure (see {@link letrec}),
3285
+ * this factor will be used to increase the probability to generate nil.
3286
+ *
3287
+ * @remarks Since 2.14.0
3288
+ */
3289
+ depthSize?: DepthSize;
3290
+ /**
3291
+ * Maximal authorized depth. Once this depth has been reached only nil will be used.
3292
+ * @defaultValue Number.POSITIVE_INFINITY — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
3293
+ * @remarks Since 2.14.0
3294
+ */
3295
+ maxDepth?: number;
3296
+ /**
3297
+ * Depth identifier can be used to share the current depth between several instances.
3298
+ *
3299
+ * By default, if not specified, each instance of option will have its own depth.
3300
+ * In other words: you can have depth=1 in one while you have depth=100 in another one.
3301
+ *
3302
+ * @remarks Since 2.14.0
3303
+ */
3304
+ depthIdentifier?: DepthIdentifier | string;
3305
+ }
3306
+ /**
3307
+ * For either nil or a value coming from `arb` with custom frequency
3308
+ *
3309
+ * @param arb - Arbitrary that will be called to generate a non nil value
3310
+ * @param constraints - Constraints on the option(since 1.17.0)
3311
+ *
3312
+ * @remarks Since 0.0.6
3313
+ * @public
3314
+ */
3315
+ declare function option<T, TNil = null>(arb: Arbitrary<T>, constraints?: OptionConstraints<TNil>): Arbitrary<T | TNil>;
3316
+ //#endregion
3317
+ //#region src/arbitrary/record.d.ts
3318
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
3319
+ /**
3320
+ * Constraints to be applied on {@link record}
3321
+ * @remarks Since 0.0.12
3322
+ * @public
3323
+ */
3324
+ type RecordConstraints<T = unknown> = {
3325
+ /**
3326
+ * List keys that should never be deleted.
3327
+ *
3328
+ * Remark:
3329
+ * You might need to use an explicit typing in case you need to declare symbols as required (not needed when required keys are simple strings).
3330
+ * With something like `{ requiredKeys: [mySymbol1, 'a'] as [typeof mySymbol1, 'a'] }` when both `mySymbol1` and `a` are required.
3331
+ *
3332
+ * @defaultValue Array containing all keys of recordModel
3333
+ * @remarks Since 2.11.0
3334
+ */
3335
+ requiredKeys?: T[];
3336
+ /**
3337
+ * Do not generate records with null prototype
3338
+ * @defaultValue false
3339
+ * @remarks Since 3.13.0
3340
+ */
3341
+ noNullPrototype?: boolean;
3342
+ };
3343
+ /**
3344
+ * Infer the type of the Arbitrary produced by record
3345
+ * given the type of the source arbitrary and constraints to be applied
3346
+ *
3347
+ * @remarks Since 2.2.0
3348
+ * @public
3349
+ */
3350
+ type RecordValue<T, K> = Prettify<Partial<T> & Pick<T, K & keyof T>>;
3351
+ /**
3352
+ * For records following the `recordModel` schema
3353
+ *
3354
+ * @example
3355
+ * ```typescript
3356
+ * record({ x: someArbitraryInt, y: someArbitraryInt }, {requiredKeys: []}): Arbitrary<{x?:number,y?:number}>
3357
+ * // merge two integer arbitraries to produce a {x, y}, {x}, {y} or {} record
3358
+ * ```
3359
+ *
3360
+ * @param recordModel - Schema of the record
3361
+ * @param constraints - Contraints on the generated record
3362
+ *
3363
+ * @remarks Since 0.0.12
3364
+ * @public
3365
+ */
3366
+ declare function record<T, K extends keyof T = keyof T>(model: { [K in keyof T]: Arbitrary<T[K]> }, constraints?: RecordConstraints<K>): Arbitrary<RecordValue<T, K>>;
3367
+ //#endregion
3368
+ //#region src/arbitrary/set.d.ts
3369
+ /**
3370
+ * Constraints to be applied on {@link set}
3371
+ * @remarks Since 4.4.0
3372
+ * @public
3373
+ */
3374
+ type SetConstraints = {
3375
+ /**
3376
+ * Lower bound of the generated set size
3377
+ * @defaultValue 0
3378
+ * @remarks Since 4.4.0
3379
+ */
3380
+ minLength?: number;
3381
+ /**
3382
+ * Upper bound of the generated set size
3383
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
3384
+ * @remarks Since 4.4.0
3385
+ */
3386
+ maxLength?: number;
3387
+ /**
3388
+ * Define how large the generated values should be (at max)
3389
+ * @remarks Since 4.4.0
3390
+ */
3391
+ size?: SizeForArbitrary;
3392
+ /**
3393
+ * When receiving a depth identifier, the arbitrary will impact the depth
3394
+ * attached to it to avoid going too deep if it already generated lots of items.
3395
+ *
3396
+ * In other words, if the number of generated values within the collection is large
3397
+ * then the generated items will tend to be less deep to avoid creating structures a lot
3398
+ * larger than expected.
3399
+ *
3400
+ * For the moment, the depth is not taken into account to compute the number of items to
3401
+ * define for a precise generate call of the set. Just applied onto eligible items.
3402
+ *
3403
+ * @remarks Since 4.4.0
3404
+ */
3405
+ depthIdentifier?: DepthIdentifier | string;
3406
+ };
3407
+ /**
3408
+ * For sets of values coming from `arb`
3409
+ *
3410
+ * All the values in the set are unique. Comparison of values relies on `SameValueZero`
3411
+ * which is the same comparison algorithm used by `Set`.
3412
+ *
3413
+ * @param arb - Arbitrary used to generate the values inside the set
3414
+ * @param constraints - Constraints to apply when building instances
3415
+ *
3416
+ * @remarks Since 4.4.0
3417
+ * @public
3418
+ */
3419
+ declare function set<T>(arb: Arbitrary<T>, constraints?: SetConstraints): Arbitrary<Set<T>>;
3420
+ //#endregion
3421
+ //#region src/arbitrary/infiniteStream.d.ts
3422
+ /**
3423
+ * Constraints to be applied on {@link infiniteStream}
3424
+ * @remarks Since 4.3.0
3425
+ * @public
3426
+ */
3427
+ interface InfiniteStreamConstraints {
3428
+ /**
3429
+ * Do not save items emitted by this arbitrary and print count instead.
3430
+ * Recommended for very large tests.
3431
+ *
3432
+ * @defaultValue false
3433
+ */
3434
+ noHistory?: boolean;
3435
+ }
3436
+ /**
3437
+ * Produce an infinite stream of values
3438
+ *
3439
+ * WARNING: By default, infiniteStream remembers all values it has ever
3440
+ * generated. This causes unbounded memory growth during large tests.
3441
+ * Set noHistory to disable.
3442
+ *
3443
+ * WARNING: Requires Object.assign
3444
+ *
3445
+ * @param arb - Arbitrary used to generate the values
3446
+ * @param constraints - Constraints to apply when building instances (since 4.3.0)
3447
+ *
3448
+ * @remarks Since 1.8.0
3449
+ * @public
3450
+ */
3451
+ declare function infiniteStream<T>(arb: Arbitrary<T>, constraints?: InfiniteStreamConstraints): Arbitrary<Stream<T>>;
3452
+ //#endregion
3453
+ //#region src/arbitrary/base64String.d.ts
3454
+ /**
3455
+ * For base64 strings
3456
+ *
3457
+ * A base64 string will always have a length multiple of 4 (padded with =)
3458
+ *
3459
+ * @param constraints - Constraints to apply when building instances (since 2.4.0)
3460
+ *
3461
+ * @remarks Since 0.0.1
3462
+ * @public
3463
+ */
3464
+ declare function base64String(constraints?: StringSharedConstraints): Arbitrary<string>;
3465
+ //#endregion
3466
+ //#region src/arbitrary/subarray.d.ts
3467
+ /**
3468
+ * Constraints to be applied on {@link subarray}
3469
+ * @remarks Since 2.4.0
3470
+ * @public
3471
+ */
3472
+ interface SubarrayConstraints {
3473
+ /**
3474
+ * Lower bound of the generated subarray size (included)
3475
+ * @defaultValue 0
3476
+ * @remarks Since 2.4.0
3477
+ */
3478
+ minLength?: number;
3479
+ /**
3480
+ * Upper bound of the generated subarray size (included)
3481
+ * @defaultValue The length of the original array itself
3482
+ * @remarks Since 2.4.0
3483
+ */
3484
+ maxLength?: number;
3485
+ }
3486
+ /**
3487
+ * For subarrays of `originalArray` (keeps ordering)
3488
+ *
3489
+ * @param originalArray - Original array
3490
+ * @param constraints - Constraints to apply when building instances (since 2.4.0)
3491
+ *
3492
+ * @remarks Since 1.5.0
3493
+ * @public
3494
+ */
3495
+ declare function subarray<T>(originalArray: T[], constraints?: SubarrayConstraints): Arbitrary<T[]>;
3496
+ //#endregion
3497
+ //#region src/arbitrary/shuffledSubarray.d.ts
3498
+ /**
3499
+ * Constraints to be applied on {@link shuffledSubarray}
3500
+ * @remarks Since 2.18.0
3501
+ * @public
3502
+ */
3503
+ interface ShuffledSubarrayConstraints {
3504
+ /**
3505
+ * Lower bound of the generated subarray size (included)
3506
+ * @defaultValue 0
3507
+ * @remarks Since 2.4.0
3508
+ */
3509
+ minLength?: number;
3510
+ /**
3511
+ * Upper bound of the generated subarray size (included)
3512
+ * @defaultValue The length of the original array itself
3513
+ * @remarks Since 2.4.0
3514
+ */
3515
+ maxLength?: number;
3516
+ }
3517
+ /**
3518
+ * For subarrays of `originalArray`
3519
+ *
3520
+ * @param originalArray - Original array
3521
+ * @param constraints - Constraints to apply when building instances (since 2.4.0)
3522
+ *
3523
+ * @remarks Since 1.5.0
3524
+ * @public
3525
+ */
3526
+ declare function shuffledSubarray<T>(originalArray: T[], constraints?: ShuffledSubarrayConstraints): Arbitrary<T[]>;
3527
+ //#endregion
3528
+ //#region src/arbitrary/tuple.d.ts
3529
+ /**
3530
+ * For tuples produced using the provided `arbs`
3531
+ *
3532
+ * @param arbs - Ordered list of arbitraries
3533
+ *
3534
+ * @remarks Since 0.0.1
3535
+ * @public
3536
+ */
3537
+ declare function tuple<Ts extends unknown[]>(...arbs: { [K in keyof Ts]: Arbitrary<Ts[K]> }): Arbitrary<Ts>;
3538
+ //#endregion
3539
+ //#region src/arbitrary/ulid.d.ts
3540
+ /**
3541
+ * For ulid
3542
+ *
3543
+ * According to {@link https://github.com/ulid/spec | ulid spec}
3544
+ *
3545
+ * No mixed case, only upper case digits (0-9A-Z except for: I,L,O,U)
3546
+ *
3547
+ * @remarks Since 3.11.0
3548
+ * @public
3549
+ */
3550
+ declare function ulid(): Arbitrary<string>;
3551
+ //#endregion
3552
+ //#region src/arbitrary/uuid.d.ts
3553
+ /**
3554
+ * Constraints to be applied on {@link uuid}
3555
+ * @remarks Since 3.21.0
3556
+ * @public
3557
+ */
3558
+ interface UuidConstraints {
3559
+ /**
3560
+ * Define accepted versions in the [1-15] according to {@link https://datatracker.ietf.org/doc/html/rfc9562#name-version-field | RFC 9562}
3561
+ * @defaultValue [1,2,3,4,5,6,7,8]
3562
+ * @remarks Since 3.21.0
3563
+ */
3564
+ version?: (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15) | (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15)[];
3565
+ }
3566
+ /**
3567
+ * For UUID from v1 to v5
3568
+ *
3569
+ * According to {@link https://tools.ietf.org/html/rfc4122 | RFC 4122}
3570
+ *
3571
+ * No mixed case, only lower case digits (0-9a-f)
3572
+ *
3573
+ * @remarks Since 1.17.0
3574
+ * @public
3575
+ */
3576
+ declare function uuid(constraints?: UuidConstraints): Arbitrary<string>;
3577
+ //#endregion
3578
+ //#region src/arbitrary/webAuthority.d.ts
3579
+ /**
3580
+ * Constraints to be applied on {@link webAuthority}
3581
+ * @remarks Since 1.14.0
3582
+ * @public
3583
+ */
3584
+ interface WebAuthorityConstraints {
3585
+ /**
3586
+ * Enable IPv4 in host
3587
+ * @defaultValue false
3588
+ * @remarks Since 1.14.0
3589
+ */
3590
+ withIPv4?: boolean;
3591
+ /**
3592
+ * Enable IPv6 in host
3593
+ * @defaultValue false
3594
+ * @remarks Since 1.14.0
3595
+ */
3596
+ withIPv6?: boolean;
3597
+ /**
3598
+ * Enable extended IPv4 format
3599
+ * @defaultValue false
3600
+ * @remarks Since 1.17.0
3601
+ */
3602
+ withIPv4Extended?: boolean;
3603
+ /**
3604
+ * Enable user information prefix
3605
+ * @defaultValue false
3606
+ * @remarks Since 1.14.0
3607
+ */
3608
+ withUserInfo?: boolean;
3609
+ /**
3610
+ * Enable port suffix
3611
+ * @defaultValue false
3612
+ * @remarks Since 1.14.0
3613
+ */
3614
+ withPort?: boolean;
3615
+ /**
3616
+ * Define how large the generated values should be (at max)
3617
+ * @remarks Since 2.22.0
3618
+ */
3619
+ size?: Exclude<SizeForArbitrary, "max">;
3620
+ }
3621
+ /**
3622
+ * For web authority
3623
+ *
3624
+ * According to {@link https://www.ietf.org/rfc/rfc3986.txt | RFC 3986} - `authority = [ userinfo "@" ] host [ ":" port ]`
3625
+ *
3626
+ * @param constraints - Constraints to apply when building instances
3627
+ *
3628
+ * @remarks Since 1.14.0
3629
+ * @public
3630
+ */
3631
+ declare function webAuthority(constraints?: WebAuthorityConstraints): Arbitrary<string>;
3632
+ //#endregion
3633
+ //#region src/arbitrary/webFragments.d.ts
3634
+ /**
3635
+ * Constraints to be applied on {@link webFragments}
3636
+ * @remarks Since 2.22.0
3637
+ * @public
3638
+ */
3639
+ interface WebFragmentsConstraints {
3640
+ /**
3641
+ * Define how large the generated values should be (at max)
3642
+ * @remarks Since 2.22.0
3643
+ */
3644
+ size?: Exclude<SizeForArbitrary, "max">;
3645
+ }
3646
+ /**
3647
+ * For fragments of an URI (web included)
3648
+ *
3649
+ * According to {@link https://www.ietf.org/rfc/rfc3986.txt | RFC 3986}
3650
+ *
3651
+ * eg.: In the url `https://domain/plop?page=1#hello=1&world=2`, `?hello=1&world=2` are query parameters
3652
+ *
3653
+ * @param constraints - Constraints to apply when building instances (since 2.22.0)
3654
+ *
3655
+ * @remarks Since 1.14.0
3656
+ * @public
3657
+ */
3658
+ declare function webFragments(constraints?: WebFragmentsConstraints): Arbitrary<string>;
3659
+ //#endregion
3660
+ //#region src/arbitrary/webPath.d.ts
3661
+ /**
3662
+ * Constraints to be applied on {@link webPath}
3663
+ * @remarks Since 3.3.0
3664
+ * @public
3665
+ */
3666
+ interface WebPathConstraints {
3667
+ /**
3668
+ * Define how large the generated values should be (at max)
3669
+ * @remarks Since 3.3.0
3670
+ */
3671
+ size?: Exclude<SizeForArbitrary, "max">;
3672
+ }
3673
+ /**
3674
+ * For web path
3675
+ *
3676
+ * According to {@link https://www.ietf.org/rfc/rfc3986.txt | RFC 3986} and
3677
+ * {@link https://url.spec.whatwg.org/ | WHATWG URL Standard}
3678
+ *
3679
+ * @param constraints - Constraints to apply when building instances
3680
+ *
3681
+ * @remarks Since 3.3.0
3682
+ * @public
3683
+ */
3684
+ declare function webPath(constraints?: WebPathConstraints): Arbitrary<string>;
3685
+ //#endregion
3686
+ //#region src/arbitrary/webQueryParameters.d.ts
3687
+ /**
3688
+ * Constraints to be applied on {@link webQueryParameters}
3689
+ * @remarks Since 2.22.0
3690
+ * @public
3691
+ */
3692
+ interface WebQueryParametersConstraints {
3693
+ /**
3694
+ * Define how large the generated values should be (at max)
3695
+ * @remarks Since 2.22.0
3696
+ */
3697
+ size?: Exclude<SizeForArbitrary, "max">;
3698
+ }
3699
+ /**
3700
+ * For query parameters of an URI (web included)
3701
+ *
3702
+ * According to {@link https://www.ietf.org/rfc/rfc3986.txt | RFC 3986}
3703
+ *
3704
+ * eg.: In the url `https://domain/plop/?hello=1&world=2`, `?hello=1&world=2` are query parameters
3705
+ *
3706
+ * @param constraints - Constraints to apply when building instances (since 2.22.0)
3707
+ *
3708
+ * @remarks Since 1.14.0
3709
+ * @public
3710
+ */
3711
+ declare function webQueryParameters(constraints?: WebQueryParametersConstraints): Arbitrary<string>;
3712
+ //#endregion
3713
+ //#region src/arbitrary/webSegment.d.ts
3714
+ /**
3715
+ * Constraints to be applied on {@link webSegment}
3716
+ * @remarks Since 2.22.0
3717
+ * @public
3718
+ */
3719
+ interface WebSegmentConstraints {
3720
+ /**
3721
+ * Define how large the generated values should be (at max)
3722
+ * @remarks Since 2.22.0
3723
+ */
3724
+ size?: Exclude<SizeForArbitrary, "max">;
3725
+ }
3726
+ /**
3727
+ * For internal segment of an URI (web included)
3728
+ *
3729
+ * According to {@link https://www.ietf.org/rfc/rfc3986.txt | RFC 3986}
3730
+ *
3731
+ * eg.: In the url `https://github.com/dubzzz/fast-check/`, `dubzzz` and `fast-check` are segments
3732
+ *
3733
+ * @param constraints - Constraints to apply when building instances (since 2.22.0)
3734
+ *
3735
+ * @remarks Since 1.14.0
3736
+ * @public
3737
+ */
3738
+ declare function webSegment(constraints?: WebSegmentConstraints): Arbitrary<string>;
3739
+ //#endregion
3740
+ //#region src/arbitrary/webUrl.d.ts
3741
+ /**
3742
+ * Constraints to be applied on {@link webUrl}
3743
+ * @remarks Since 1.14.0
3744
+ * @public
3745
+ */
3746
+ interface WebUrlConstraints {
3747
+ /**
3748
+ * Enforce specific schemes, eg.: http, https
3749
+ * @defaultValue ['http', 'https']
3750
+ * @remarks Since 1.14.0
3751
+ */
3752
+ validSchemes?: string[];
3753
+ /**
3754
+ * Settings for {@link webAuthority}
3755
+ * @defaultValue &#123;&#125;
3756
+ * @remarks Since 1.14.0
3757
+ */
3758
+ authoritySettings?: WebAuthorityConstraints;
3759
+ /**
3760
+ * Enable query parameters in the generated url
3761
+ * @defaultValue false
3762
+ * @remarks Since 1.14.0
3763
+ */
3764
+ withQueryParameters?: boolean;
3765
+ /**
3766
+ * Enable fragments in the generated url
3767
+ * @defaultValue false
3768
+ * @remarks Since 1.14.0
3769
+ */
3770
+ withFragments?: boolean;
3771
+ /**
3772
+ * Define how large the generated values should be (at max)
3773
+ * @remarks Since 2.22.0
3774
+ */
3775
+ size?: Exclude<SizeForArbitrary, "max">;
3776
+ }
3777
+ /**
3778
+ * For web url
3779
+ *
3780
+ * According to {@link https://www.ietf.org/rfc/rfc3986.txt | RFC 3986} and
3781
+ * {@link https://url.spec.whatwg.org/ | WHATWG URL Standard}
3782
+ *
3783
+ * @param constraints - Constraints to apply when building instances
3784
+ *
3785
+ * @remarks Since 1.14.0
3786
+ * @public
3787
+ */
3788
+ declare function webUrl(constraints?: WebUrlConstraints): Arbitrary<string>;
3789
+ //#endregion
3790
+ //#region src/check/model/command/ICommand.d.ts
3791
+ /**
3792
+ * Interface that should be implemented in order to define a command
3793
+ * @remarks Since 1.5.0
3794
+ * @public
3795
+ */
3796
+ interface ICommand<Model extends object, Real, RunResult, CheckAsync extends boolean = false> {
3797
+ /**
3798
+ * Check if the model is in the right state to apply the command
3799
+ *
3800
+ * WARNING: does not change the model
3801
+ *
3802
+ * @param m - Model, simplified or schematic representation of real system
3803
+ *
3804
+ * @remarks Since 1.5.0
3805
+ */
3806
+ check(m: Readonly<Model>): CheckAsync extends false ? boolean : Promise<boolean>;
3807
+ /**
3808
+ * Receive the non-updated model and the real or system under test.
3809
+ * Perform the checks post-execution - Throw in case of invalid state.
3810
+ * Update the model accordingly
3811
+ *
3812
+ * @param m - Model, simplified or schematic representation of real system
3813
+ * @param r - Sytem under test
3814
+ *
3815
+ * @remarks Since 1.5.0
3816
+ */
3817
+ run(m: Model, r: Real): RunResult;
3818
+ /**
3819
+ * Name of the command
3820
+ * @remarks Since 1.5.0
3821
+ */
3822
+ toString(): string;
3823
+ }
3824
+ //#endregion
3825
+ //#region src/check/model/command/AsyncCommand.d.ts
3826
+ /**
3827
+ * Interface that should be implemented in order to define
3828
+ * an asynchronous command
3829
+ *
3830
+ * @remarks Since 1.5.0
3831
+ * @public
3832
+ */
3833
+ interface AsyncCommand<Model extends object, Real, CheckAsync extends boolean = false> extends ICommand<Model, Real, Promise<void>, CheckAsync> {}
3834
+ //#endregion
3835
+ //#region src/check/model/command/Command.d.ts
3836
+ /**
3837
+ * Interface that should be implemented in order to define
3838
+ * a synchronous command
3839
+ *
3840
+ * @remarks Since 1.5.0
3841
+ * @public
3842
+ */
3843
+ interface Command<Model extends object, Real> extends ICommand<Model, Real, void> {}
3844
+ //#endregion
3845
+ //#region src/check/model/commands/CommandsContraints.d.ts
3846
+ /**
3847
+ * Parameters for {@link commands}
3848
+ * @remarks Since 2.2.0
3849
+ * @public
3850
+ */
3851
+ interface CommandsContraints {
3852
+ /**
3853
+ * Maximal number of commands to generate per run
3854
+ *
3855
+ * You probably want to use `size` instead.
3856
+ *
3857
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
3858
+ * @remarks Since 1.11.0
3859
+ */
3860
+ maxCommands?: number;
3861
+ /**
3862
+ * Define how large the generated values (number of commands) should be (at max)
3863
+ * @remarks Since 2.22.0
3864
+ */
3865
+ size?: SizeForArbitrary;
3866
+ /**
3867
+ * Do not show replayPath in the output
3868
+ * @defaultValue false
3869
+ * @remarks Since 1.11.0
3870
+ */
3871
+ disableReplayLog?: boolean;
3872
+ /**
3873
+ * Hint for replay purposes only
3874
+ *
3875
+ * Should be used in conjonction with `{ seed, path }` of {@link assert}
3876
+ *
3877
+ * @remarks Since 1.11.0
3878
+ */
3879
+ replayPath?: string;
3880
+ }
3881
+ //#endregion
3882
+ //#region src/arbitrary/commands.d.ts
3883
+ /**
3884
+ * For arrays of {@link AsyncCommand} to be executed by {@link asyncModelRun}
3885
+ *
3886
+ * This implementation comes with a shrinker adapted for commands.
3887
+ * It should shrink more efficiently than {@link array} for {@link AsyncCommand} arrays.
3888
+ *
3889
+ * @param commandArbs - Arbitraries responsible to build commands
3890
+ * @param constraints - Constraints to be applied when generating the commands (since 1.11.0)
3891
+ *
3892
+ * @remarks Since 1.5.0
3893
+ * @public
3894
+ */
3895
+ declare function commands<Model extends object, Real, CheckAsync extends boolean>(commandArbs: Arbitrary<AsyncCommand<Model, Real, CheckAsync>>[], constraints?: CommandsContraints): Arbitrary<Iterable<AsyncCommand<Model, Real, CheckAsync>>>;
3896
+ /**
3897
+ * For arrays of {@link Command} to be executed by {@link modelRun}
3898
+ *
3899
+ * This implementation comes with a shrinker adapted for commands.
3900
+ * It should shrink more efficiently than {@link array} for {@link Command} arrays.
3901
+ *
3902
+ * @param commandArbs - Arbitraries responsible to build commands
3903
+ * @param constraints - Constraints to be applied when generating the commands (since 1.11.0)
3904
+ *
3905
+ * @remarks Since 1.5.0
3906
+ * @public
3907
+ */
3908
+ declare function commands<Model extends object, Real>(commandArbs: Arbitrary<Command<Model, Real>>[], constraints?: CommandsContraints): Arbitrary<Iterable<Command<Model, Real>>>;
3909
+ //#endregion
3910
+ //#region src/arbitrary/_internals/interfaces/Scheduler.d.ts
3911
+ /**
3912
+ * Function responsible to run the passed function and surround it with whatever needed.
3913
+ * The name has been inspired from the `act` function coming with React.
3914
+ *
3915
+ * This wrapper function is not supposed to throw. The received function f will never throw.
3916
+ *
3917
+ * Wrapping order in the following:
3918
+ *
3919
+ * - global act defined on `fc.scheduler` wraps wait level one
3920
+ * - wait act defined on `s.waitX` wraps local one
3921
+ * - local act defined on `s.scheduleX(...)` wraps the trigger function
3922
+ *
3923
+ * @remarks Since 3.9.0
3924
+ * @public
3925
+ */
3926
+ type SchedulerAct = (f: () => Promise<void>) => Promise<void>;
3927
+ /**
3928
+ * Instance able to reschedule the ordering of promises for a given app
3929
+ * @remarks Since 1.20.0
3930
+ * @public
3931
+ */
3932
+ interface Scheduler<TMetaData = unknown> {
3933
+ /**
3934
+ * Wrap a new task using the Scheduler
3935
+ * @remarks Since 1.20.0
3936
+ */
3937
+ schedule: <T>(task: Promise<T>, label?: string, metadata?: TMetaData, customAct?: SchedulerAct) => Promise<T>;
3938
+ /**
3939
+ * Automatically wrap function output using the Scheduler
3940
+ * @remarks Since 1.20.0
3941
+ */
3942
+ scheduleFunction: <TArgs extends any[], T>(asyncFunction: (...args: TArgs) => Promise<T>, customAct?: SchedulerAct) => (...args: TArgs) => Promise<T>;
3943
+ /**
3944
+ * Schedule a sequence of Promise to be executed sequencially.
3945
+ * Items within the sequence might be interleaved by other scheduled operations.
3946
+ *
3947
+ * Please note that whenever an item from the sequence has started,
3948
+ * the scheduler will wait until its end before moving to another scheduled task.
3949
+ *
3950
+ * A handle is returned by the function in order to monitor the state of the sequence.
3951
+ * Sequence will be marked:
3952
+ * - done if all the promises have been executed properly
3953
+ * - faulty if one of the promises within the sequence throws
3954
+ *
3955
+ * @remarks Since 1.20.0
3956
+ */
3957
+ scheduleSequence(sequenceBuilders: SchedulerSequenceItem<TMetaData>[], customAct?: SchedulerAct): {
3958
+ done: boolean;
3959
+ faulty: boolean;
3960
+ task: Promise<{
3961
+ done: boolean;
3962
+ faulty: boolean;
3963
+ }>;
3964
+ };
3965
+ /**
3966
+ * Count of pending scheduled tasks
3967
+ * @remarks Since 1.20.0
3968
+ */
3969
+ count(): number;
3970
+ /**
3971
+ * Wait one scheduled task to be executed
3972
+ * @throws Whenever there is no task scheduled
3973
+ * @remarks Since 1.20.0
3974
+ * @deprecated Use `waitNext(1)` instead, it comes with a more predictable behavior
3975
+ */
3976
+ waitOne: (customAct?: SchedulerAct) => Promise<void>;
3977
+ /**
3978
+ * Wait all scheduled tasks,
3979
+ * including the ones that might be created by one of the resolved task
3980
+ * @remarks Since 1.20.0
3981
+ * @deprecated Use `waitIdle()` instead, it comes with a more predictable behavior awaiting all scheduled and reachable tasks to be completed
3982
+ */
3983
+ waitAll: (customAct?: SchedulerAct) => Promise<void>;
3984
+ /**
3985
+ * Wait and schedule exactly `count` scheduled tasks.
3986
+ * @remarks Since 4.2.0
3987
+ */
3988
+ waitNext: (count: number, customAct?: SchedulerAct) => Promise<void>;
3989
+ /**
3990
+ * Wait until the scheduler becomes idle: all scheduled and reachable tasks have completed.
3991
+ *
3992
+ * It will include tasks scheduled by other tasks, recursively.
3993
+ *
3994
+ * Note: Tasks triggered by uncontrolled sources (like `fetch` or external events) cannot be detected
3995
+ * or awaited and may lead to incomplete waits.
3996
+ *
3997
+ * If you want to wait for a precise event to happen you should rather opt for `waitFor` or `waitNext`
3998
+ * given they offer you a more granular control on what you are exactly waiting for.
3999
+ *
4000
+ * @remarks Since 4.2.0
4001
+ */
4002
+ waitIdle: (customAct?: SchedulerAct) => Promise<void>;
4003
+ /**
4004
+ * Wait as many scheduled tasks as need to resolve the received Promise
4005
+ *
4006
+ * Some tests frameworks like `supertest` are not triggering calls to subsequent queries in a synchronous way,
4007
+ * some are waiting an explicit call to `then` to trigger them (either synchronously or asynchronously)...
4008
+ * As a consequence, none of `waitOne` or `waitAll` cannot wait for them out-of-the-box.
4009
+ *
4010
+ * This helper is responsible to wait as many scheduled tasks as needed (but the bare minimal) to get
4011
+ * `unscheduledTask` resolved. Once resolved it returns its output either success or failure.
4012
+ *
4013
+ * Be aware that while this helper will wait eveything to be ready for `unscheduledTask` to resolve,
4014
+ * having uncontrolled tasks triggering stuff required for `unscheduledTask` might be a source a uncontrollable
4015
+ * and not reproducible randomness as those triggers cannot be handled and scheduled by fast-check.
4016
+ *
4017
+ * @remarks Since 2.24.0
4018
+ */
4019
+ waitFor: <T>(unscheduledTask: Promise<T>, customAct?: SchedulerAct) => Promise<T>;
4020
+ /**
4021
+ * Produce an array containing all the scheduled tasks so far with their execution status.
4022
+ * If the task has been executed, it includes a string representation of the associated output or error produced by the task if any.
4023
+ *
4024
+ * Tasks will be returned in the order they get executed by the scheduler.
4025
+ *
4026
+ * @remarks Since 1.25.0
4027
+ */
4028
+ report: () => SchedulerReportItem<TMetaData>[];
4029
+ }
4030
+ /**
4031
+ * Define an item to be passed to `scheduleSequence`
4032
+ * @remarks Since 1.20.0
4033
+ * @public
4034
+ */
4035
+ type SchedulerSequenceItem<TMetaData = unknown> = {
4036
+ /**
4037
+ * Builder to start the task
4038
+ * @remarks Since 1.20.0
4039
+ */
4040
+ builder: () => Promise<any>;
4041
+ /**
4042
+ * Label
4043
+ * @remarks Since 1.20.0
4044
+ */
4045
+ label: string;
4046
+ /**
4047
+ * Metadata to be attached into logs
4048
+ * @remarks Since 1.25.0
4049
+ */
4050
+ metadata?: TMetaData;
4051
+ } | (() => Promise<any>);
4052
+ /**
4053
+ * Describe a task for the report produced by the scheduler
4054
+ * @remarks Since 1.25.0
4055
+ * @public
4056
+ */
4057
+ interface SchedulerReportItem<TMetaData = unknown> {
4058
+ /**
4059
+ * Execution status for this task
4060
+ * - resolved: task released by the scheduler and successful
4061
+ * - rejected: task released by the scheduler but with errors
4062
+ * - pending: task still pending in the scheduler, not released yet
4063
+ *
4064
+ * @remarks Since 1.25.0
4065
+ */
4066
+ status: "resolved" | "rejected" | "pending";
4067
+ /**
4068
+ * How was this task scheduled?
4069
+ * - promise: schedule
4070
+ * - function: scheduleFunction
4071
+ * - sequence: scheduleSequence
4072
+ *
4073
+ * @remarks Since 1.25.0
4074
+ */
4075
+ schedulingType: "promise" | "function" | "sequence";
4076
+ /**
4077
+ * Incremental id for the task, first received task has taskId = 1
4078
+ * @remarks Since 1.25.0
4079
+ */
4080
+ taskId: number;
4081
+ /**
4082
+ * Label of the task
4083
+ * @remarks Since 1.25.0
4084
+ */
4085
+ label: string;
4086
+ /**
4087
+ * Metadata linked when scheduling the task
4088
+ * @remarks Since 1.25.0
4089
+ */
4090
+ metadata?: TMetaData;
4091
+ /**
4092
+ * Stringified version of the output or error computed using fc.stringify
4093
+ * @remarks Since 1.25.0
4094
+ */
4095
+ outputValue?: string;
4096
+ }
4097
+ //#endregion
4098
+ //#region src/arbitrary/scheduler.d.ts
4099
+ /**
4100
+ * Constraints to be applied on {@link scheduler}
4101
+ * @remarks Since 2.2.0
4102
+ * @public
4103
+ */
4104
+ interface SchedulerConstraints {
4105
+ /**
4106
+ * Ensure that all scheduled tasks will be executed in the right context (for instance it can be the `act` of React)
4107
+ * @remarks Since 1.21.0
4108
+ */
4109
+ act: (f: () => Promise<void>) => Promise<unknown>;
4110
+ }
4111
+ /**
4112
+ * For scheduler of promises
4113
+ * @remarks Since 1.20.0
4114
+ * @public
4115
+ */
4116
+ declare function scheduler<TMetaData = unknown>(constraints?: SchedulerConstraints): Arbitrary<Scheduler<TMetaData>>;
4117
+ /**
4118
+ * For custom scheduler with predefined resolution order
4119
+ *
4120
+ * Ordering is defined by using a template string like the one generated in case of failure of a {@link scheduler}
4121
+ *
4122
+ * It may be something like:
4123
+ *
4124
+ * @example
4125
+ * ```typescript
4126
+ * fc.schedulerFor()`
4127
+ * -> [task\${2}] promise pending
4128
+ * -> [task\${3}] promise pending
4129
+ * -> [task\${1}] promise pending
4130
+ * `
4131
+ * ```
4132
+ *
4133
+ * Or more generally:
4134
+ * ```typescript
4135
+ * fc.schedulerFor()`
4136
+ * This scheduler will resolve task ${2} first
4137
+ * followed by ${3} and only then task ${1}
4138
+ * `
4139
+ * ```
4140
+ *
4141
+ * WARNING:
4142
+ * Custom scheduler will
4143
+ * neither check that all the referred promises have been scheduled
4144
+ * nor that they resolved with the same status and value.
4145
+ *
4146
+ *
4147
+ * WARNING:
4148
+ * If one the promises is wrongly defined it will fail - for instance asking to resolve 5 while 5 does not exist.
4149
+ *
4150
+ * @remarks Since 1.25.0
4151
+ * @public
4152
+ */
4153
+ declare function schedulerFor<TMetaData = unknown>(constraints?: SchedulerConstraints): (_strs: TemplateStringsArray, ...ordering: number[]) => Scheduler<TMetaData>;
4154
+ /**
4155
+ * For custom scheduler with predefined resolution order
4156
+ *
4157
+ * WARNING:
4158
+ * Custom scheduler will not check that all the referred promises have been scheduled.
4159
+ *
4160
+ *
4161
+ * WARNING:
4162
+ * If one the promises is wrongly defined it will fail - for instance asking to resolve 5 while 5 does not exist.
4163
+ *
4164
+ * @param customOrdering - Array defining in which order the promises will be resolved.
4165
+ * Id of the promises start at 1. 1 means first scheduled promise, 2 second scheduled promise and so on.
4166
+ *
4167
+ * @remarks Since 1.25.0
4168
+ * @public
4169
+ */
4170
+ declare function schedulerFor<TMetaData = unknown>(customOrdering: number[], constraints?: SchedulerConstraints): Scheduler<TMetaData>;
4171
+ //#endregion
4172
+ //#region src/check/model/ModelRunner.d.ts
4173
+ /**
4174
+ * Synchronous definition of model and real
4175
+ * @remarks Since 2.2.0
4176
+ * @public
4177
+ */
4178
+ type ModelRunSetup<Model, Real> = () => {
4179
+ model: Model;
4180
+ real: Real;
4181
+ };
4182
+ /**
4183
+ * Asynchronous definition of model and real
4184
+ * @remarks Since 2.2.0
4185
+ * @public
4186
+ */
4187
+ type ModelRunAsyncSetup<Model, Real> = () => Promise<{
4188
+ model: Model;
4189
+ real: Real;
4190
+ }>;
4191
+ /**
4192
+ * Run synchronous commands over a `Model` and the `Real` system
4193
+ *
4194
+ * Throw in case of inconsistency
4195
+ *
4196
+ * @param s - Initial state provider
4197
+ * @param cmds - Synchronous commands to be executed
4198
+ *
4199
+ * @remarks Since 1.5.0
4200
+ * @public
4201
+ */
4202
+ declare function modelRun<Model extends object, Real, InitialModel extends Model>(s: ModelRunSetup<InitialModel, Real>, cmds: Iterable<Command<Model, Real>>): void;
4203
+ /**
4204
+ * Run asynchronous commands over a `Model` and the `Real` system
4205
+ *
4206
+ * Throw in case of inconsistency
4207
+ *
4208
+ * @param s - Initial state provider
4209
+ * @param cmds - Asynchronous commands to be executed
4210
+ *
4211
+ * @remarks Since 1.5.0
4212
+ * @public
4213
+ */
4214
+ declare function asyncModelRun<Model extends object, Real, CheckAsync extends boolean, InitialModel extends Model>(s: ModelRunSetup<InitialModel, Real> | ModelRunAsyncSetup<InitialModel, Real>, cmds: Iterable<AsyncCommand<Model, Real, CheckAsync>>): Promise<void>;
4215
+ /**
4216
+ * Run asynchronous and scheduled commands over a `Model` and the `Real` system
4217
+ *
4218
+ * Throw in case of inconsistency
4219
+ *
4220
+ * @param scheduler - Scheduler
4221
+ * @param s - Initial state provider
4222
+ * @param cmds - Asynchronous commands to be executed
4223
+ *
4224
+ * @remarks Since 1.24.0
4225
+ * @public
4226
+ */
4227
+ declare function scheduledModelRun<Model extends object, Real, CheckAsync extends boolean, InitialModel extends Model>(scheduler: Scheduler, s: ModelRunSetup<InitialModel, Real> | ModelRunAsyncSetup<InitialModel, Real>, cmds: Iterable<AsyncCommand<Model, Real, CheckAsync>>): Promise<void>;
4228
+ //#endregion
4229
+ //#region src/check/symbols.d.ts
4230
+ /**
4231
+ * Generated instances having a method [cloneMethod]
4232
+ * will be automatically cloned whenever necessary
4233
+ *
4234
+ * This is pretty useful for statefull generated values.
4235
+ * For instance, whenever you use a Stream you directly impact it.
4236
+ * Implementing [cloneMethod] on the generated Stream would force
4237
+ * the framework to clone it whenever it has to re-use it
4238
+ * (mainly required for chrinking process)
4239
+ *
4240
+ * @remarks Since 1.8.0
4241
+ * @public
4242
+ */
4243
+ declare const cloneMethod: unique symbol;
4244
+ /**
4245
+ * Object instance that should be cloned from one generation/shrink to another
4246
+ * @remarks Since 2.15.0
4247
+ * @public
4248
+ */
4249
+ interface WithCloneMethod<T> {
4250
+ [cloneMethod]: () => T;
4251
+ }
4252
+ /**
4253
+ * Check if an instance has to be clone
4254
+ * @remarks Since 2.15.0
4255
+ * @public
4256
+ */
4257
+ declare function hasCloneMethod<T>(instance: T | WithCloneMethod<T>): instance is WithCloneMethod<T>;
4258
+ /**
4259
+ * Clone an instance if needed
4260
+ * @remarks Since 2.15.0
4261
+ * @public
4262
+ */
4263
+ declare function cloneIfNeeded<T>(instance: T): T;
4264
+ //#endregion
4265
+ //#region src/utils/hash.d.ts
4266
+ /**
4267
+ * CRC-32 based hash function
4268
+ *
4269
+ * Used internally by fast-check in {@link func}, {@link compareFunc} or even {@link compareBooleanFunc}.
4270
+ *
4271
+ * @param repr - String value to be hashed
4272
+ *
4273
+ * @remarks Since 2.1.0
4274
+ * @public
4275
+ */
4276
+ declare function hash(repr: string): number;
4277
+ //#endregion
4278
+ //#region src/utils/stringify.d.ts
4279
+ /**
4280
+ * Use this symbol to define a custom serializer for your instances.
4281
+ * Serializer must be a function returning a string (see {@link WithToStringMethod}).
4282
+ *
4283
+ * @remarks Since 2.17.0
4284
+ * @public
4285
+ */
4286
+ declare const toStringMethod: unique symbol;
4287
+ /**
4288
+ * Interface to implement for {@link toStringMethod}
4289
+ *
4290
+ * @remarks Since 2.17.0
4291
+ * @public
4292
+ */
4293
+ type WithToStringMethod = {
4294
+ [toStringMethod]: () => string;
4295
+ };
4296
+ /**
4297
+ * Check if an instance implements {@link WithToStringMethod}
4298
+ *
4299
+ * @remarks Since 2.17.0
4300
+ * @public
4301
+ */
4302
+ declare function hasToStringMethod<T>(instance: T): instance is T & WithToStringMethod;
4303
+ /**
4304
+ * Use this symbol to define a custom serializer for your instances.
4305
+ * Serializer must be a function returning a promise of string (see {@link WithAsyncToStringMethod}).
4306
+ *
4307
+ * Please note that:
4308
+ * 1. It will only be useful for asynchronous properties.
4309
+ * 2. It has to return barely instantly.
4310
+ *
4311
+ * @remarks Since 2.17.0
4312
+ * @public
4313
+ */
4314
+ declare const asyncToStringMethod: unique symbol;
4315
+ /**
4316
+ * Interface to implement for {@link asyncToStringMethod}
4317
+ *
4318
+ * @remarks Since 2.17.0
4319
+ * @public
4320
+ */
4321
+ type WithAsyncToStringMethod = {
4322
+ [asyncToStringMethod]: () => Promise<string>;
4323
+ };
4324
+ /**
4325
+ * Check if an instance implements {@link WithAsyncToStringMethod}
4326
+ *
4327
+ * @remarks Since 2.17.0
4328
+ * @public
4329
+ */
4330
+ declare function hasAsyncToStringMethod<T>(instance: T): instance is T & WithAsyncToStringMethod;
4331
+ /**
4332
+ * Convert any value to its fast-check string representation
4333
+ *
4334
+ * @param value - Value to be converted into a string
4335
+ *
4336
+ * @remarks Since 1.15.0
4337
+ * @public
4338
+ */
4339
+ declare function stringify<Ts>(value: Ts): string;
4340
+ /**
4341
+ * Convert any value to its fast-check string representation
4342
+ *
4343
+ * This asynchronous version is also able to dig into the status of Promise
4344
+ *
4345
+ * @param value - Value to be converted into a string
4346
+ *
4347
+ * @remarks Since 2.17.0
4348
+ * @public
4349
+ */
4350
+ declare function asyncStringify<Ts>(value: Ts): Promise<string>;
4351
+ //#endregion
4352
+ //#region src/check/runner/utils/RunDetailsFormatter.d.ts
4353
+ /**
4354
+ * Format output of {@link check} using the default error reporting of {@link assert}
4355
+ *
4356
+ * Produce a string containing the formated error in case of failed run,
4357
+ * undefined otherwise.
4358
+ *
4359
+ * @remarks Since 1.25.0
4360
+ * @public
4361
+ */
4362
+ declare function defaultReportMessage<Ts>(out: RunDetails<Ts> & {
4363
+ failed: false;
4364
+ }): undefined;
4365
+ /**
4366
+ * Format output of {@link check} using the default error reporting of {@link assert}
4367
+ *
4368
+ * Produce a string containing the formated error in case of failed run,
4369
+ * undefined otherwise.
4370
+ *
4371
+ * @remarks Since 1.25.0
4372
+ * @public
4373
+ */
4374
+ declare function defaultReportMessage<Ts>(out: RunDetails<Ts> & {
4375
+ failed: true;
4376
+ }): string;
4377
+ /**
4378
+ * Format output of {@link check} using the default error reporting of {@link assert}
4379
+ *
4380
+ * Produce a string containing the formated error in case of failed run,
4381
+ * undefined otherwise.
4382
+ *
4383
+ * @remarks Since 1.25.0
4384
+ * @public
4385
+ */
4386
+ declare function defaultReportMessage<Ts>(out: RunDetails<Ts>): string | undefined;
4387
+ /**
4388
+ * Format output of {@link check} using the default error reporting of {@link assert}
4389
+ *
4390
+ * Produce a string containing the formated error in case of failed run,
4391
+ * undefined otherwise.
4392
+ *
4393
+ * @remarks Since 2.17.0
4394
+ * @public
4395
+ */
4396
+ declare function asyncDefaultReportMessage<Ts>(out: RunDetails<Ts> & {
4397
+ failed: false;
4398
+ }): Promise<undefined>;
4399
+ /**
4400
+ * Format output of {@link check} using the default error reporting of {@link assert}
4401
+ *
4402
+ * Produce a string containing the formated error in case of failed run,
4403
+ * undefined otherwise.
4404
+ *
4405
+ * @remarks Since 2.17.0
4406
+ * @public
4407
+ */
4408
+ declare function asyncDefaultReportMessage<Ts>(out: RunDetails<Ts> & {
4409
+ failed: true;
4410
+ }): Promise<string>;
4411
+ /**
4412
+ * Format output of {@link check} using the default error reporting of {@link assert}
4413
+ *
4414
+ * Produce a string containing the formated error in case of failed run,
4415
+ * undefined otherwise.
4416
+ *
4417
+ * @remarks Since 2.17.0
4418
+ * @public
4419
+ */
4420
+ declare function asyncDefaultReportMessage<Ts>(out: RunDetails<Ts>): Promise<string | undefined>;
4421
+ //#endregion
4422
+ //#region src/arbitrary/_internals/builders/TypedIntArrayArbitraryBuilder.d.ts
4423
+ /**
4424
+ * Constraints to be applied on typed arrays for integer values
4425
+ * @remarks Since 2.9.0
4426
+ * @public
4427
+ */
4428
+ type IntArrayConstraints = {
4429
+ /**
4430
+ * Lower bound of the generated array size
4431
+ * @defaultValue 0
4432
+ * @remarks Since 2.9.0
4433
+ */
4434
+ minLength?: number;
4435
+ /**
4436
+ * Upper bound of the generated array size
4437
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
4438
+ * @remarks Since 2.9.0
4439
+ */
4440
+ maxLength?: number;
4441
+ /**
4442
+ * Lower bound for the generated int (included)
4443
+ * @defaultValue smallest possible value for this type
4444
+ * @remarks Since 2.9.0
4445
+ */
4446
+ min?: number;
4447
+ /**
4448
+ * Upper bound for the generated int (included)
4449
+ * @defaultValue highest possible value for this type
4450
+ * @remarks Since 2.9.0
4451
+ */
4452
+ max?: number;
4453
+ /**
4454
+ * Define how large the generated values should be (at max)
4455
+ * @remarks Since 2.22.0
4456
+ */
4457
+ size?: SizeForArbitrary;
4458
+ };
4459
+ /**
4460
+ * Constraints to be applied on typed arrays for big int values
4461
+ * @remarks Since 3.0.0
4462
+ * @public
4463
+ */
4464
+ type BigIntArrayConstraints = {
4465
+ /**
4466
+ * Lower bound of the generated array size
4467
+ * @defaultValue 0
4468
+ * @remarks Since 3.0.0
4469
+ */
4470
+ minLength?: number;
4471
+ /**
4472
+ * Upper bound of the generated array size
4473
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
4474
+ * @remarks Since 3.0.0
4475
+ */
4476
+ maxLength?: number;
4477
+ /**
4478
+ * Lower bound for the generated int (included)
4479
+ * @defaultValue smallest possible value for this type
4480
+ * @remarks Since 3.0.0
4481
+ */
4482
+ min?: bigint;
4483
+ /**
4484
+ * Upper bound for the generated int (included)
4485
+ * @defaultValue highest possible value for this type
4486
+ * @remarks Since 3.0.0
4487
+ */
4488
+ max?: bigint;
4489
+ /**
4490
+ * Define how large the generated values should be (at max)
4491
+ * @remarks Since 3.0.0
4492
+ */
4493
+ size?: SizeForArbitrary;
4494
+ };
4495
+ //#endregion
4496
+ //#region src/arbitrary/int8Array.d.ts
4497
+ /**
4498
+ * For Int8Array
4499
+ * @remarks Since 2.9.0
4500
+ * @public
4501
+ */
4502
+ declare function int8Array(constraints?: IntArrayConstraints): Arbitrary<Int8Array<ArrayBuffer>>;
4503
+ //#endregion
4504
+ //#region src/arbitrary/int16Array.d.ts
4505
+ /**
4506
+ * For Int16Array
4507
+ * @remarks Since 2.9.0
4508
+ * @public
4509
+ */
4510
+ declare function int16Array(constraints?: IntArrayConstraints): Arbitrary<Int16Array<ArrayBuffer>>;
4511
+ //#endregion
4512
+ //#region src/arbitrary/int32Array.d.ts
4513
+ /**
4514
+ * For Int32Array
4515
+ * @remarks Since 2.9.0
4516
+ * @public
4517
+ */
4518
+ declare function int32Array(constraints?: IntArrayConstraints): Arbitrary<Int32Array<ArrayBuffer>>;
4519
+ //#endregion
4520
+ //#region src/arbitrary/uint8Array.d.ts
4521
+ /**
4522
+ * For Uint8Array
4523
+ * @remarks Since 2.9.0
4524
+ * @public
4525
+ */
4526
+ declare function uint8Array(constraints?: IntArrayConstraints): Arbitrary<Uint8Array<ArrayBuffer>>;
4527
+ //#endregion
4528
+ //#region src/arbitrary/uint8ClampedArray.d.ts
4529
+ /**
4530
+ * For Uint8ClampedArray
4531
+ * @remarks Since 2.9.0
4532
+ * @public
4533
+ */
4534
+ declare function uint8ClampedArray(constraints?: IntArrayConstraints): Arbitrary<Uint8ClampedArray<ArrayBuffer>>;
4535
+ //#endregion
4536
+ //#region src/arbitrary/uint16Array.d.ts
4537
+ /**
4538
+ * For Uint16Array
4539
+ * @remarks Since 2.9.0
4540
+ * @public
4541
+ */
4542
+ declare function uint16Array(constraints?: IntArrayConstraints): Arbitrary<Uint16Array<ArrayBuffer>>;
4543
+ //#endregion
4544
+ //#region src/arbitrary/uint32Array.d.ts
4545
+ /**
4546
+ * For Uint32Array
4547
+ * @remarks Since 2.9.0
4548
+ * @public
4549
+ */
4550
+ declare function uint32Array(constraints?: IntArrayConstraints): Arbitrary<Uint32Array<ArrayBuffer>>;
4551
+ //#endregion
4552
+ //#region src/arbitrary/float32Array.d.ts
4553
+ /**
4554
+ * Constraints to be applied on {@link float32Array}
4555
+ * @remarks Since 2.9.0
4556
+ * @public
4557
+ */
4558
+ type Float32ArrayConstraints = {
4559
+ /**
4560
+ * Lower bound of the generated array size
4561
+ * @defaultValue 0
4562
+ * @remarks Since 2.9.0
4563
+ */
4564
+ minLength?: number;
4565
+ /**
4566
+ * Upper bound of the generated array size
4567
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
4568
+ * @remarks Since 2.9.0
4569
+ */
4570
+ maxLength?: number;
4571
+ /**
4572
+ * Define how large the generated values should be (at max)
4573
+ * @remarks Since 2.22.0
4574
+ */
4575
+ size?: SizeForArbitrary;
4576
+ } & FloatConstraints;
4577
+ /**
4578
+ * For Float32Array
4579
+ * @remarks Since 2.9.0
4580
+ * @public
4581
+ */
4582
+ declare function float32Array(constraints?: Float32ArrayConstraints): Arbitrary<Float32Array<ArrayBuffer>>;
4583
+ //#endregion
4584
+ //#region src/arbitrary/float64Array.d.ts
4585
+ /**
4586
+ * Constraints to be applied on {@link float64Array}
4587
+ * @remarks Since 2.9.0
4588
+ * @public
4589
+ */
4590
+ type Float64ArrayConstraints = {
4591
+ /**
4592
+ * Lower bound of the generated array size
4593
+ * @defaultValue 0
4594
+ * @remarks Since 2.9.0
4595
+ */
4596
+ minLength?: number;
4597
+ /**
4598
+ * Upper bound of the generated array size
4599
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
4600
+ * @remarks Since 2.9.0
4601
+ */
4602
+ maxLength?: number;
4603
+ /**
4604
+ * Define how large the generated values should be (at max)
4605
+ * @remarks Since 2.22.0
4606
+ */
4607
+ size?: SizeForArbitrary;
4608
+ } & DoubleConstraints;
4609
+ /**
4610
+ * For Float64Array
4611
+ * @remarks Since 2.9.0
4612
+ * @public
4613
+ */
4614
+ declare function float64Array(constraints?: Float64ArrayConstraints): Arbitrary<Float64Array<ArrayBuffer>>;
4615
+ //#endregion
4616
+ //#region src/arbitrary/sparseArray.d.ts
4617
+ /**
4618
+ * Constraints to be applied on {@link sparseArray}
4619
+ * @remarks Since 2.13.0
4620
+ * @public
4621
+ */
4622
+ interface SparseArrayConstraints {
4623
+ /**
4624
+ * Upper bound of the generated array size (maximal size: 4294967295)
4625
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
4626
+ * @remarks Since 2.13.0
4627
+ */
4628
+ maxLength?: number;
4629
+ /**
4630
+ * Lower bound of the number of non-hole elements
4631
+ * @defaultValue 0
4632
+ * @remarks Since 2.13.0
4633
+ */
4634
+ minNumElements?: number;
4635
+ /**
4636
+ * Upper bound of the number of non-hole elements
4637
+ * @defaultValue 0x7fffffff — _defaulting seen as "max non specified" when `defaultSizeToMaxWhenMaxSpecified=true`_
4638
+ * @remarks Since 2.13.0
4639
+ */
4640
+ maxNumElements?: number;
4641
+ /**
4642
+ * When enabled, all generated arrays will either be the empty array or end by a non-hole
4643
+ * @defaultValue false
4644
+ * @remarks Since 2.13.0
4645
+ */
4646
+ noTrailingHole?: boolean;
4647
+ /**
4648
+ * Define how large the generated values should be (at max)
4649
+ * @remarks Since 2.22.0
4650
+ */
4651
+ size?: SizeForArbitrary;
4652
+ /**
4653
+ * When receiving a depth identifier, the arbitrary will impact the depth
4654
+ * attached to it to avoid going too deep if it already generated lots of items.
4655
+ *
4656
+ * In other words, if the number of generated values within the collection is large
4657
+ * then the generated items will tend to be less deep to avoid creating structures a lot
4658
+ * larger than expected.
4659
+ *
4660
+ * For the moment, the depth is not taken into account to compute the number of items to
4661
+ * define for a precise generate call of the array. Just applied onto eligible items.
4662
+ *
4663
+ * @remarks Since 2.25.0
4664
+ */
4665
+ depthIdentifier?: DepthIdentifier | string;
4666
+ }
4667
+ /**
4668
+ * For sparse arrays of values coming from `arb`
4669
+ * @param arb - Arbitrary used to generate the values inside the sparse array
4670
+ * @param constraints - Constraints to apply when building instances
4671
+ * @remarks Since 2.13.0
4672
+ * @public
4673
+ */
4674
+ declare function sparseArray<T>(arb: Arbitrary<T>, constraints?: SparseArrayConstraints): Arbitrary<T[]>;
4675
+ //#endregion
4676
+ //#region src/arbitrary/bigInt64Array.d.ts
4677
+ /**
4678
+ * For BigInt64Array
4679
+ * @remarks Since 3.0.0
4680
+ * @public
4681
+ */
4682
+ declare function bigInt64Array(constraints?: BigIntArrayConstraints): Arbitrary<BigInt64Array<ArrayBuffer>>;
4683
+ //#endregion
4684
+ //#region src/arbitrary/bigUint64Array.d.ts
4685
+ /**
4686
+ * For BigUint64Array
4687
+ * @remarks Since 3.0.0
4688
+ * @public
4689
+ */
4690
+ declare function bigUint64Array(constraints?: BigIntArrayConstraints): Arbitrary<BigUint64Array<ArrayBuffer>>;
4691
+ //#endregion
4692
+ //#region src/arbitrary/stringMatching.d.ts
4693
+ /**
4694
+ * Constraints to be applied on the arbitrary {@link stringMatching}
4695
+ * @remarks Since 3.10.0
4696
+ * @public
4697
+ */
4698
+ type StringMatchingConstraints = {
4699
+ /**
4700
+ * Upper bound of the generated string length (included)
4701
+ * @defaultValue 0x7fffffff
4702
+ * @remarks Since 4.6.0
4703
+ */
4704
+ maxLength?: number;
4705
+ /**
4706
+ * Define how large the generated values should be (at max)
4707
+ * @remarks Since 3.10.0
4708
+ */
4709
+ size?: SizeForArbitrary;
4710
+ };
4711
+ /**
4712
+ * For strings matching the provided regex
4713
+ *
4714
+ * @param regex - Arbitrary able to generate random strings (possibly multiple characters)
4715
+ * @param constraints - Constraints to apply when building instances
4716
+ *
4717
+ * @remarks Since 3.10.0
4718
+ * @public
4719
+ */
4720
+ declare function stringMatching(regex: RegExp, constraints?: StringMatchingConstraints): Arbitrary<string>;
4721
+ //#endregion
4722
+ //#region src/arbitrary/noShrink.d.ts
4723
+ /**
4724
+ * Build an arbitrary without shrinking capabilities.
4725
+ *
4726
+ * NOTE:
4727
+ * In most cases, users should avoid disabling shrinking capabilities.
4728
+ * If the concern is the shrinking process taking too long or being unnecessary in CI environments,
4729
+ * consider using alternatives like `endOnFailure` or `interruptAfterTimeLimit` instead.
4730
+ *
4731
+ * @param arb - The original arbitrary used for generating values. This arbitrary remains unchanged, but its shrinking capabilities will not be included in the new arbitrary.
4732
+ *
4733
+ * @remarks Since 3.20.0
4734
+ * @public
4735
+ */
4736
+ declare function noShrink<T>(arb: Arbitrary<T>): Arbitrary<T>;
4737
+ //#endregion
4738
+ //#region src/arbitrary/noBias.d.ts
4739
+ /**
4740
+ * Build an arbitrary without any bias.
4741
+ *
4742
+ * The produced instance wraps the source one and ensures the bias factor will always be passed to undefined meaning bias will be deactivated.
4743
+ * All the rest stays unchanged.
4744
+ *
4745
+ * @param arb - The original arbitrary used for generating values. This arbitrary remains unchanged.
4746
+ *
4747
+ * @remarks Since 3.20.0
4748
+ * @public
4749
+ */
4750
+ declare function noBias<T>(arb: Arbitrary<T>): Arbitrary<T>;
4751
+ //#endregion
4752
+ //#region src/arbitrary/limitShrink.d.ts
4753
+ /**
4754
+ * Create another Arbitrary with a limited (or capped) number of shrink values
4755
+ *
4756
+ * @example
4757
+ * ```typescript
4758
+ * const dataGenerator: Arbitrary<string> = ...;
4759
+ * const limitedShrinkableDataGenerator: Arbitrary<string> = fc.limitShrink(dataGenerator, 10);
4760
+ * // up to 10 shrunk values could be extracted from the resulting arbitrary
4761
+ * ```
4762
+ *
4763
+ * NOTE: Although limiting the shrinking capabilities can speed up your CI when failures occur, we do not recommend this approach.
4764
+ * Instead, if you want to reduce the shrinking time for automated jobs or local runs, consider using `endOnFailure` or `interruptAfterTimeLimit`.
4765
+ *
4766
+ * @param arbitrary - Instance of arbitrary responsible to generate and shrink values
4767
+ * @param maxShrinks - Maximal number of shrunk values that can be pulled from the resulting arbitrary
4768
+ *
4769
+ * @returns Create another arbitrary with limited number of shrink values
4770
+ * @remarks Since 3.20.0
4771
+ * @public
4772
+ */
4773
+ declare function limitShrink<T>(arbitrary: Arbitrary<T>, maxShrinks: number): Arbitrary<T>;
4774
+ /** @public */ declare namespace fc {
4775
+ export { Arbitrary, ArrayConstraints, AsyncCommand, AsyncPropertyHookFunction, BigIntArrayConstraints, BigIntConstraints, CloneValue, Command, CommandsContraints, ContextValue, DateConstraints, DepthContext, DepthIdentifier, DepthSize, DictionaryConstraints, DomainConstraints, DoubleConstraints, EmailAddressConstraints, Arbitraries as EntityGraphArbitraries, EntityGraphContraints, EntityRelations as EntityGraphRelations, EntityGraphValue, ExecutionStatus, ExecutionTree, FalsyContraints, FalsyValue, Float32ArrayConstraints, Float64ArrayConstraints, FloatConstraints, GeneratorValue, GlobalAsyncPropertyHookFunction, GlobalParameters, GlobalPropertyHookFunction, IAsyncProperty, IAsyncPropertyWithHooks, ICommand, IProperty, IPropertyWithHooks, IRawProperty, IntArrayConstraints, IntegerConstraints, JsonSharedConstraints, JsonValue, LetrecLooselyTypedBuilder, LetrecLooselyTypedTie, LetrecTypedBuilder, LetrecTypedTie, LetrecValue, LoremConstraints, MapConstraints, MaybeWeightedArbitrary, Memo, MixedCaseConstraints, ModelRunAsyncSetup, ModelRunSetup, NatConstraints, ObjectConstraints, OneOfConstraints, OneOfValue, OptionConstraints, Parameters, PreconditionFailure, PropertyFailure, PropertyHookFunction, Random, RandomGenerator, RandomType, RecordConstraints, RecordValue, RunDetails, RunDetailsCommon, RunDetailsFailureInterrupted, RunDetailsFailureProperty, RunDetailsFailureTooManySkips, RunDetailsSuccess, Scheduler, SchedulerAct, SchedulerConstraints, SchedulerReportItem, SchedulerSequenceItem, SetConstraints, ShuffledSubarrayConstraints, Size, SizeForArbitrary, SparseArrayConstraints, Stream, StringConstraints, StringMatchingConstraints, StringSharedConstraints, SubarrayConstraints, UniqueArrayConstraints, UniqueArrayConstraintsCustomCompare, UniqueArrayConstraintsCustomCompareSelect, UniqueArrayConstraintsRecommended, UniqueArraySharedConstraints, UuidConstraints, Value, VerbosityLevel, WebAuthorityConstraints, WebFragmentsConstraints, WebPathConstraints, WebQueryParametersConstraints, WebSegmentConstraints, WebUrlConstraints, WeightedArbitrary, WithAsyncToStringMethod, WithCloneMethod, WithToStringMethod, __commitHash, __type, __version, anything, array, assert, asyncDefaultReportMessage, asyncModelRun, asyncProperty, asyncStringify, asyncToStringMethod, base64String, bigInt, bigInt64Array, bigUint64Array, boolean, check, clone, cloneIfNeeded, cloneMethod, commands, compareBooleanFunc, compareFunc, configureGlobal, constant, constantFrom, context, createDepthIdentifier, date, defaultReportMessage, dictionary, domain, double, emailAddress, entityGraph, falsy, float, float32Array, float64Array, func, gen, getDepthContextFor, hasAsyncToStringMethod, hasCloneMethod, hasToStringMethod, hash, infiniteStream, int16Array, int32Array, int8Array, integer, ipV4, ipV4Extended, ipV6, json, jsonValue, letrec, limitShrink, lorem, map, mapToConstant, maxSafeInteger, maxSafeNat, memo, mixedCase, modelRun, nat, noBias, noShrink, object, oneof, option, pre, property, readConfigureGlobal, record, resetConfigureGlobal, sample, scheduledModelRun, scheduler, schedulerFor, set, shuffledSubarray, sparseArray, statistics, stream, string, stringMatching, stringify, subarray, toStringMethod, tuple, uint16Array, uint32Array, uint8Array, uint8ClampedArray, ulid, uniqueArray, uuid, webAuthority, webFragments, webPath, webQueryParameters, webSegment, webUrl };
4776
+ }
4777
+ /**
4778
+ * Type of module (commonjs or module)
4779
+ * @remarks Since 1.22.0
4780
+ * @public
4781
+ */
4782
+ declare const __type: string;
4783
+ /**
4784
+ * Version of fast-check used by your project (eg.: "4.6.0")
4785
+ * @remarks Since 1.22.0
4786
+ * @public
4787
+ */
4788
+ declare const __version: string;
4789
+ /**
4790
+ * Commit hash of the current code (eg.: "f4b9e1de4a98c664d5e2bd31c47b33b9b6b50dc9")
4791
+ * @remarks Since 2.7.0
4792
+ * @public
4793
+ */
4794
+ declare const __commitHash: string;
4795
+ //#endregion
4796
+ export { Arbitrary, type ArrayConstraints, type AsyncCommand, type AsyncPropertyHookFunction, type BigIntArrayConstraints, type BigIntConstraints, type CloneValue, type Command, type CommandsContraints, type ContextValue, type DateConstraints, type DepthContext, type DepthIdentifier, type DepthSize, type DictionaryConstraints, type DomainConstraints, type DoubleConstraints, type EmailAddressConstraints, type Arbitraries as EntityGraphArbitraries, type EntityGraphContraints, type EntityRelations as EntityGraphRelations, type EntityGraphValue, ExecutionStatus, type ExecutionTree, type FalsyContraints, type FalsyValue, type Float32ArrayConstraints, type Float64ArrayConstraints, type FloatConstraints, type GeneratorValue, type GlobalAsyncPropertyHookFunction, type GlobalParameters, type GlobalPropertyHookFunction, type IAsyncProperty, type IAsyncPropertyWithHooks, type ICommand, type IProperty, type IPropertyWithHooks, type IRawProperty, type IntArrayConstraints, type IntegerConstraints, type JsonSharedConstraints, type JsonValue, type LetrecLooselyTypedBuilder, type LetrecLooselyTypedTie, type LetrecTypedBuilder, type LetrecTypedTie, type LetrecValue, type LoremConstraints, type MapConstraints, type MaybeWeightedArbitrary, type Memo, type MixedCaseConstraints, type ModelRunAsyncSetup, type ModelRunSetup, type NatConstraints, type ObjectConstraints, type OneOfConstraints, type OneOfValue, type OptionConstraints, type Parameters, PreconditionFailure, type PropertyFailure, type PropertyHookFunction, Random, type RandomGenerator, type RandomType, type RecordConstraints, type RecordValue, type RunDetails, type RunDetailsCommon, type RunDetailsFailureInterrupted, type RunDetailsFailureProperty, type RunDetailsFailureTooManySkips, type RunDetailsSuccess, type Scheduler, type SchedulerAct, type SchedulerConstraints, type SchedulerReportItem, type SchedulerSequenceItem, type SetConstraints, type ShuffledSubarrayConstraints, type Size, type SizeForArbitrary, type SparseArrayConstraints, Stream, type StringConstraints, type StringMatchingConstraints, type StringSharedConstraints, type SubarrayConstraints, type UniqueArrayConstraints, type UniqueArrayConstraintsCustomCompare, type UniqueArrayConstraintsCustomCompareSelect, type UniqueArrayConstraintsRecommended, type UniqueArraySharedConstraints, type UuidConstraints, Value, VerbosityLevel, type WebAuthorityConstraints, type WebFragmentsConstraints, type WebPathConstraints, type WebQueryParametersConstraints, type WebSegmentConstraints, type WebUrlConstraints, type WeightedArbitrary, type WithAsyncToStringMethod, type WithCloneMethod, type WithToStringMethod, __commitHash, __type, __version, anything, array, assert, asyncDefaultReportMessage, asyncModelRun, asyncProperty, asyncStringify, asyncToStringMethod, base64String, bigInt, bigInt64Array, bigUint64Array, boolean, check, clone, cloneIfNeeded, cloneMethod, commands, compareBooleanFunc, compareFunc, configureGlobal, constant, constantFrom, context, createDepthIdentifier, date, fc as default, defaultReportMessage, dictionary, domain, double, emailAddress, entityGraph, falsy, float, float32Array, float64Array, func, gen, getDepthContextFor, hasAsyncToStringMethod, hasCloneMethod, hasToStringMethod, hash, infiniteStream, int16Array, int32Array, int8Array, integer, ipV4, ipV4Extended, ipV6, json, jsonValue, letrec, limitShrink, lorem, map, mapToConstant, maxSafeInteger, maxSafeNat, memo, mixedCase, modelRun, nat, noBias, noShrink, object, oneof, option, pre, property, readConfigureGlobal, record, resetConfigureGlobal, sample, scheduledModelRun, scheduler, schedulerFor, set, shuffledSubarray, sparseArray, statistics, stream, string, stringMatching, stringify, subarray, toStringMethod, tuple, uint16Array, uint32Array, uint8Array, uint8ClampedArray, ulid, uniqueArray, uuid, webAuthority, webFragments, webPath, webQueryParameters, webSegment, webUrl };