From 8c71e13cc7130beec3b3e684d5905fff8a0c9e99 Mon Sep 17 00:00:00 2001 From: Nick Schultz Date: Wed, 14 Mar 2018 09:05:42 -0400 Subject: [PATCH] the order of returned values was flipped --- types/sequelize/index.d.ts | 4 ++-- types/sequelize/sequelize-tests.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 7d72a0b096..370e96d7a1 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -4006,9 +4006,9 @@ declare namespace sequelize { * whether the row was inserted or not. */ upsert(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; - upsert(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; + upsert(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[TInstance, boolean]>; insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; - insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; + insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[TInstance, boolean]>; /** * Create and insert multiple instances in bulk. diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 5d1f6eed34..f99988b29f 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1044,7 +1044,7 @@ findOrRetVal = User.findOrCreate( { where : { email : 'unique.email.@d.com', com findOrRetVal = User.findOrCreate( { where : { objectId : 1 }, defaults : { bool : false } } ); let upsertPromiseNoOptions: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) } ); -let upsertPromiseReturning: Bluebird<[boolean, AnyInstance]> = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: true } ); +let upsertPromiseReturning: Bluebird<[AnyInstance, boolean]> = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: true } ); let upsertPromiseNotReturning: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: false } ); User.bulkCreate( [{ aNumber : 10 }, { aNumber : 12 }] ).then( ( i ) => i[0].isNewRecord );