From 66fbfdaaa6e03114607671103fe0df7ab1d781a8 Mon Sep 17 00:00:00 2001 From: Anthony Rosequist Date: Wed, 24 Feb 2021 03:38:44 -0600 Subject: [PATCH] fix: improve EntityManager.save() return type (#7391) This brings it in line with the equivalent method in Repository. --- src/entity-manager/EntityManager.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/entity-manager/EntityManager.ts b/src/entity-manager/EntityManager.ts index cc5616b48a..18216930b6 100644 --- a/src/entity-manager/EntityManager.ts +++ b/src/entity-manager/EntityManager.ts @@ -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>(targetOrEntity: EntityTarget, entities: T[], options?: SaveOptions): Promise; + save>(targetOrEntity: EntityTarget, entities: T[], options: SaveOptions & { reload: false }): Promise; /** * Saves all given entities in the database. * If entities do not exist in the database then inserts, otherwise updates. */ - save>(targetOrEntity: EntityTarget, entity: T, options?: SaveOptions): Promise; + save>(targetOrEntity: EntityTarget, 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>(targetOrEntity: EntityTarget, entity: T, options: SaveOptions & { reload: false }): Promise; + + /** + * Saves a given entity in the database. + * If entity does not exist in the database then inserts, otherwise updates. + */ + save>(targetOrEntity: EntityTarget, entity: T, options?: SaveOptions): Promise; /** * Saves a given entity in the database.