You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `getMocksFromGenerator` function preserves the types of your generator functions:
51
+
The `getMocksFromGenerator` function lets you define your own data generation logic. You provide an object where each property is a function that generates values. You can mix and match:
52
+
- Faker.js functions
53
+
- Your own custom functions
54
+
- Random value generators
55
+
- Fixed value functions
56
+
- Any JavaScript/TypeScript function that returns a value
// TypeScript infers exact return types from your generator functions
79
+
// TypeScript should infers return types from your generator functions
65
80
const objects =createRandomObjects(5);
66
81
// objects is typed as Array<{ id: string; name: string; age: number }>
67
82
```
68
83
84
+
## Contributing
69
85
70
-
71
-
### `getMocksFromGenerator`
72
-
73
-
Type-safe generator that creates mock data from a predefined generator.
74
-
75
-
**Parameters:**
76
-
-`gen`: An object where keys are property names and values are functions that generate the property values. Types are automatically inferred from your generator functions.
77
-
78
-
**Returns:**
79
-
- A strongly-typed function that generates an array of mock objects with exact property types.
86
+
This is a Test-Driven Development (TDD) project. Please read the [Contributing Guidelines](CONTRIBUTING.md) for details on development process and how to submit pull requests.
0 commit comments