UNPKG

4.65 kBTypeScriptView Raw
1import { Arbitrary } from '../check/arbitrary/definition/Arbitrary';
2/**
3 * Constraints to be applied on {@link set}
4 * @remarks Since 2.4.0
5 * @public
6 */
7export interface SetConstraints<T> {
8 /**
9 * Lower bound of the generated array size
10 * @remarks Since 2.4.0
11 */
12 minLength?: number;
13 /**
14 * Upper bound of the generated array size
15 * @remarks Since 2.4.0
16 */
17 maxLength?: number;
18 /**
19 * Compare function - Return true when the two values are equals
20 * @remarks Since 2.4.0
21 */
22 compare?: (a: T, b: T) => boolean;
23}
24/**
25 * For arrays of unique values coming from `arb`
26 *
27 * @param arb - Arbitrary used to generate the values inside the array
28 *
29 * @remarks Since 0.0.11
30 * @public
31 */
32declare function set<T>(arb: Arbitrary<T>): Arbitrary<T[]>;
33/**
34 * For arrays of unique values coming from `arb` having an upper bound size
35 *
36 * @param arb - Arbitrary used to generate the values inside the array
37 * @param maxLength - Upper bound of the generated array size
38 *
39 * @deprecated
40 * Superceded by `fc.set(arb, {maxLength})` - see {@link https://github.com/dubzzz/fast-check/issues/992 | #992}.
41 * Ease the migration with {@link https://github.com/dubzzz/fast-check/tree/main/codemods/unify-signatures | our codemod script}.
42 *
43 * @remarks Since 0.0.11
44 * @public
45 */
46declare function set<T>(arb: Arbitrary<T>, maxLength: number): Arbitrary<T[]>;
47/**
48 * For arrays of unique values coming from `arb` having lower and upper bound size
49 *
50 * @param arb - Arbitrary used to generate the values inside the array
51 * @param minLength - Lower bound of the generated array size
52 * @param maxLength - Upper bound of the generated array size
53 *
54 * @deprecated
55 * Superceded by `fc.set(arb, {minLength, maxLength})` - see {@link https://github.com/dubzzz/fast-check/issues/992 | #992}.
56 * Ease the migration with {@link https://github.com/dubzzz/fast-check/tree/main/codemods/unify-signatures | our codemod script}.
57 *
58 * @remarks Since 0.0.11
59 * @public
60 */
61declare function set<T>(arb: Arbitrary<T>, minLength: number, maxLength: number): Arbitrary<T[]>;
62/**
63 * For arrays of unique values coming from `arb` - unicity defined by `compare`
64 *
65 * @param arb - Arbitrary used to generate the values inside the array
66 * @param compare - Return true when the two values are equals
67 *
68 * @deprecated
69 * Superceded by `fc.set(arb, {compare})` - see {@link https://github.com/dubzzz/fast-check/issues/992 | #992}.
70 * Ease the migration with {@link https://github.com/dubzzz/fast-check/tree/main/codemods/unify-signatures | our codemod script}.
71 *
72 * @remarks Since 0.0.11
73 * @public
74 */
75declare function set<T>(arb: Arbitrary<T>, compare: (a: T, b: T) => boolean): Arbitrary<T[]>;
76/**
77 * For arrays of unique values coming from `arb` having an upper bound size - unicity defined by `compare`
78 *
79 * @param arb - Arbitrary used to generate the values inside the array
80 * @param maxLength - Upper bound of the generated array size
81 * @param compare - Return true when the two values are equals
82 *
83 * @deprecated
84 * Superceded by `fc.array(arb, {maxLength, compare})` - see {@link https://github.com/dubzzz/fast-check/issues/992 | #992}.
85 * Ease the migration with {@link https://github.com/dubzzz/fast-check/tree/main/codemods/unify-signatures | our codemod script}.
86 *
87 * @remarks Since 0.0.11
88 * @public
89 */
90declare function set<T>(arb: Arbitrary<T>, maxLength: number, compare: (a: T, b: T) => boolean): Arbitrary<T[]>;
91/**
92 * For arrays of unique values coming from `arb` having lower and upper bound size - unicity defined by `compare`
93 *
94 * @param arb - Arbitrary used to generate the values inside the array
95 * @param minLength - Lower bound of the generated array size
96 * @param maxLength - Upper bound of the generated array size
97 * @param compare - Return true when the two values are equals
98 *
99 * @deprecated
100 * Superceded by `fc.array(arb, {minLength, maxLength, compare})` - see {@link https://github.com/dubzzz/fast-check/issues/992 | #992}.
101 * Ease the migration with {@link https://github.com/dubzzz/fast-check/tree/main/codemods/unify-signatures | our codemod script}.
102 *
103 * @remarks Since 0.0.11
104 * @public
105 */
106declare function set<T>(arb: Arbitrary<T>, minLength: number, maxLength: number, compare: (a: T, b: T) => boolean): Arbitrary<T[]>;
107/**
108 * For arrays of unique values coming from `arb`
109 *
110 * @param arb - Arbitrary used to generate the values inside the array
111 * @param constraints - Constraints to apply when building instances
112 *
113 * @remarks Since 2.4.0
114 * @public
115 */
116declare function set<T>(arb: Arbitrary<T>, constraints: SetConstraints<T>): Arbitrary<T[]>;
117export { set };