diff --git a/types/lib/sequelize.d.ts b/types/lib/sequelize.d.ts index e86d456fc089..86646c27e238 100644 --- a/types/lib/sequelize.d.ts +++ b/types/lib/sequelize.d.ts @@ -1185,7 +1185,7 @@ export class Sequelize extends Hooks { options: QueryOptionsWithModel ): Promise; public query(sql: string | { query: string; values: unknown[] }, options: QueryOptionsWithType): Promise; - public query(sql: string | { query: string; values: unknown[] }, options?: QueryOptions | QueryOptionsWithType): Promise; + public query(sql: string | { query: string; values: unknown[] }, options?: QueryOptions | QueryOptionsWithType): Promise<[unknown[], unknown]>; /** * Get the fn for random based on the dialect diff --git a/types/test/sequelize.ts b/types/test/sequelize.ts index 216db5b181cc..4d7a4bfd5a3d 100644 --- a/types/test/sequelize.ts +++ b/types/test/sequelize.ts @@ -1,4 +1,4 @@ -import { Config, Sequelize, Model } from 'sequelize'; +import { Config, Sequelize, Model, QueryTypes } from 'sequelize'; import { Fn } from '../lib/utils'; Sequelize.useCLS({ @@ -53,4 +53,10 @@ class Model1 extends Model{} class Model2 extends Model{} const myModel: typeof Model1 = sequelize.models.asd; myModel.hasOne(Model2) -myModel.findAll(); \ No newline at end of file +myModel.findAll(); + +sequelize.query('SELECT * FROM `user`', { type: QueryTypes.RAW }).then(result => { + const data = result[0]; + const arraysOnly = (a: any[]) => a; + arraysOnly(data); +});