diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index a9b59a0766..74be4db7c3 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3865,8 +3865,8 @@ declare namespace sequelize { * Search for a single instance by its primary key. This applies LIMIT 1, so the listener will * always be called with a single instance. */ - findById(identifier?: number | string, options?: FindOptions): Promise; - findByPrimary(identifier?: number | string, options?: FindOptions): Promise; + findById(identifier?: number | string | Buffer, options?: FindOptions): Promise; + findByPrimary(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 diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index f99988b29f..fb49abd88e 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -957,6 +957,12 @@ User.findAll( { where: { $or:[ { username: { $not: "user" } }, { theDate: new Da User.findAll( { where: { emails: { $overlap: ["me@mail.com", "you@mail.com"] } } } ); User.findById( 'a string' ); +User.findById( 42 ); +User.findById( Buffer.from('a buffer') ); + +User.findByPrimary( 'a string' ); +User.findByPrimary( 42 ); +User.findByPrimary( Buffer.from('a buffer') ); User.findOne( { where : { username : 'foo' } } ); User.findOne( { where : { id : 1 }, attributes : ['id', ['username', 'name']] } );