Skip to content

Commit

Permalink
fix: improve EntityManager.save() return type (#7391)
Browse files Browse the repository at this point in the history
This brings it in line with the equivalent method in Repository.
  • Loading branch information
arosequist committed Feb 24, 2021
1 parent b97cc4f commit 66fbfda
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/entity-manager/EntityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,25 @@ export class EntityManager {
* Saves all given entities in the database.
* If entities do not exist in the database then inserts, otherwise updates.
*/
save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<T[]>;
save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entities: T[], options: SaveOptions & { reload: false }): Promise<T[]>;

/**
* Saves all given entities in the database.
* If entities do not exist in the database then inserts, otherwise updates.
*/
save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T>;
save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entities: T[], options?: SaveOptions): Promise<(T & Entity)[]>;

/**
* Saves a given entity in the database.
* If entity does not exist in the database then inserts, otherwise updates.
*/
save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options: SaveOptions & { reload: false }): Promise<T>;

/**
* Saves a given entity in the database.
* If entity does not exist in the database then inserts, otherwise updates.
*/
save<Entity, T extends DeepPartial<Entity>>(targetOrEntity: EntityTarget<Entity>, entity: T, options?: SaveOptions): Promise<T & Entity>;

/**
* Saves a given entity in the database.
Expand Down

0 comments on commit 66fbfda

Please sign in to comment.