@@ -233,7 +233,7 @@ For all entities we want to create, we need to define a factory. To do so we giv
233
233
234
234
| Types | Description |
235
235
| --------------- | ------------------------------------------------------------------------------- |
236
- | ` Entity ` | TypeORM Entity like the user or the pet in the samples. |
236
+ | ` Entity ` | TypeORM Entity like the user or the pet in the samples. |
237
237
| ` Context ` | Argument to pass some static data into the factory function. |
238
238
| ` EntityFactory ` | This object is used to make new filled entities or create it into the database. |
239
239
@@ -242,7 +242,7 @@ For all entities we want to create, we need to define a factory. To do so we giv
242
242
The define function creates a new entity factory.
243
243
244
244
``` typescript
245
- define : <Entity , Context >(entity : Entity , factoryFn : FactoryFunction <Entity , Context >) => void ;
245
+ define : <Entity extends ObjectLiteral , Context >(entity : Entity , factoryFn : FactoryFunction <Entity , Context >) => void ;
246
246
```
247
247
248
248
``` typescript
@@ -258,7 +258,7 @@ define(User, (faker: typeof Faker, context: { roles: string[] }) => { ... })
258
258
Factory retrieves the defined factory function and returns the EntityFactory to start creating new enities.
259
259
260
260
``` typescript
261
- factory : (entity : Entity ) => (context ? : Context ) => EntityFactory < Entity , Context >
261
+ factory : (entity : Entity extends ObjectLiteral ) => (context ? : Context ) => EntityFactory <Entity , Context >
262
262
` ` `
263
263
264
264
` ` ` typescript
@@ -273,7 +273,7 @@ factory(Pet)({ name: 'Balou' })
273
273
Use the ` .map ()` function to alter the generated value before they get persisted.
274
274
275
275
` ` ` typescript
276
- map (mapFunction : (entity : Entity ) => Promise < Entity > ): EntityFactory < Entity , Context >
276
+ map (mapFunction : (entity : Entity extends ObjectLiteral ) => Promise <Entity >): EntityFactory <Entity , Context >
277
277
` ` `
278
278
279
279
` ` ` typescript
0 commit comments