From 41c1ba2436b475b70f6db7964be45cfd29ade9cd Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 8 Nov 2018 09:24:35 -0600 Subject: [PATCH 1/2] added findByPk function to Model def added findByPk function to Model definition --- types/sequelize/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index f80d5acc40..88ed87efae 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3908,6 +3908,7 @@ declare namespace sequelize { */ findById(identifier?: number | string | Buffer, options?: FindOptions): Promise; findByPrimary(identifier?: number | string | Buffer, options?: FindOptions): Promise; + findByPk(identifier?: number | string | Buffer, options?: FindOptions): Promise; /** * Search for a single instance. This applies LIMIT 1, so the listener will always be called with a single From 09fe13180eebd08684018bd2090a935a2eb7bc5b Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 8 Nov 2018 09:29:42 -0600 Subject: [PATCH 2/2] added tests for Model.findByPk added tests for Model.findByPk --- types/sequelize/sequelize-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 4e0aa9a73d..6b7ea6ea0a 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -981,6 +981,10 @@ User.findByPrimary( 'a string' ); User.findByPrimary( 42 ); User.findByPrimary( Buffer.from('a buffer') ); +User.findByPk( 'a string' ); +User.findByPk( 42 ); +User.findByPk( Buffer.from('a buffer') ); + User.findOne( { where : { username : 'foo' } } ); User.findOne( { where : { id : 1 }, attributes : ['id', ['username', 'name']] } ); User.findOne( { where : { id : 1 }, attributes : ['id'] } );