Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/lib/sequelize.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ export class Sequelize extends Hooks {
options: QueryOptionsWithModel
): Promise<M[]>;
public query<T extends object>(sql: string | { query: string; values: unknown[] }, options: QueryOptionsWithType<QueryTypes.SELECT>): Promise<T[]>;
public query(sql: string | { query: string; values: unknown[] }, options?: QueryOptions | QueryOptionsWithType<QueryTypes.RAW>): Promise<unknown[]>;
public query(sql: string | { query: string; values: unknown[] }, options?: QueryOptions | QueryOptionsWithType<QueryTypes.RAW>): Promise<[unknown[], unknown]>;

/**
* Get the fn for random based on the dialect
Expand Down
10 changes: 8 additions & 2 deletions types/test/sequelize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config, Sequelize, Model } from 'sequelize';
import { Config, Sequelize, Model, QueryTypes } from 'sequelize';
import { Fn } from '../lib/utils';

Sequelize.useCLS({
Expand Down Expand Up @@ -53,4 +53,10 @@ class Model1 extends Model{}
class Model2 extends Model{}
const myModel: typeof Model1 = sequelize.models.asd;
myModel.hasOne(Model2)
myModel.findAll();
myModel.findAll();

sequelize.query('SELECT * FROM `user`', { type: QueryTypes.RAW }).then(result => {
const data = result[0];
const arraysOnly = (a: any[]) => a;
arraysOnly(data);
});
Comment thread
jpollard-cs marked this conversation as resolved.