Skip to content

Commit 4d5be9a

Browse files
SimonSchicksushantdhiman
authored andcommitted
fix(types): add models property to sequelize class (#10736)
1 parent 88228d7 commit 4d5be9a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

types/lib/sequelize.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,13 @@ export class Sequelize extends Hooks {
696696

697697
public readonly connectionManager: ConnectionManager;
698698

699+
/**
700+
* Dictionary of all models linked with this instance.
701+
*/
702+
public readonly models: {
703+
[key: string]: typeof Model;
704+
};
705+
699706
/**
700707
* Instantiate sequelize with name of database, username and password
701708
*

types/test/sequelize.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Config, Sequelize } from 'sequelize';
1+
import { Config, Sequelize, Model } from 'sequelize';
22

33
Sequelize.useCLS({
44
});
@@ -45,3 +45,4 @@ Sequelize.afterConnect(() => {
4545

4646
});
4747

48+
const myModel: typeof Model = sequelize.models.asd;

0 commit comments

Comments
 (0)