File tree Expand file tree Collapse file tree 2 files changed +24
-27
lines changed Expand file tree Collapse file tree 2 files changed +24
-27
lines changed Original file line number Diff line number Diff line change @@ -11,28 +11,27 @@ import {ISequelizeAssociation} from "../../interfaces/ISequelizeAssociation";
1111export class Sequelize extends SequelizeOrigin implements BaseSequelize {
1212
1313 // to fix "$1" called with something that's not an instance of Sequelize.Model
14- Model : any = Function ;
14+ Model : any ;
1515
16- throughMap : { [ through : string ] : any } = { } ;
17- _ : { [ modelName : string ] : typeof Model } = { } ;
16+ throughMap : { [ through : string ] : any } ;
17+ _ : { [ modelName : string ] : typeof Model } ;
1818 init : ( config : SequelizeConfig ) => void ;
1919 addModels : ( models : Array < typeof Model > | string [ ] ) => void ;
2020 associateModels : ( models : Array < typeof Model > ) => void ;
2121
2222 constructor ( config : SequelizeConfig | string ) {
23-
24- super (
25- ( typeof config === "string" ) ?
26- config : // URI string
27- BaseSequelize . isISequelizeUriConfig ( config ) ?
28- config . uri : // URI string from ISequelizeUriConfig
29- BaseSequelize . prepareConfig ( config ) // Config object (ISequelizeConfig)
30- ) ;
31-
32- if ( BaseSequelize . isISequelizeUriConfig ( config ) ) {
33- this . options = { ...this . options , ...config } ;
23+ if ( typeof config === "string" ) {
24+ super ( config )
25+ } else if ( BaseSequelize . isISequelizeUriConfig ( config ) ) {
26+ super ( config . uri , config )
27+ } else {
28+ super ( BaseSequelize . prepareConfig ( config ) )
3429 }
3530
31+ this . throughMap = { }
32+ this . _ = { }
33+ this . Model = Function
34+
3635 if ( typeof config !== "string" ) {
3736 this . init ( config ) ;
3837 }
Original file line number Diff line number Diff line change @@ -9,26 +9,24 @@ import {ISequelizeAssociation} from "../../interfaces/ISequelizeAssociation";
99
1010export class Sequelize extends OriginSequelize implements BaseSequelize {
1111
12- throughMap : { [ through : string ] : any } = { } ;
13- _ : { [ modelName : string ] : typeof Model } = { } ;
12+ throughMap : { [ through : string ] : any } ;
13+ _ : { [ modelName : string ] : typeof Model } ;
1414 init : ( config : SequelizeConfig ) => void ;
1515 addModels : ( models : Array < typeof Model > | string [ ] ) => void ;
1616 associateModels : ( models : Array < typeof Model > ) => void ;
1717
1818 constructor ( config : SequelizeConfig | string ) {
19-
20- super (
21- ( typeof config === "string" ) ?
22- config : // URI string
23- BaseSequelize . isISequelizeUriConfig ( config ) ?
24- config . uri : // URI string from ISequelizeUriConfig
25- BaseSequelize . prepareConfig ( config ) // Config object (ISequelizeConfig)
26- ) ;
27-
28- if ( BaseSequelize . isISequelizeUriConfig ( config ) ) {
29- this . options = { ...this . options , ...config } ;
19+ if ( typeof config === "string" ) {
20+ super ( config )
21+ } else if ( BaseSequelize . isISequelizeUriConfig ( config ) ) {
22+ super ( config . uri , config )
23+ } else {
24+ super ( BaseSequelize . prepareConfig ( config ) )
3025 }
3126
27+ this . throughMap = { }
28+ this . _ = { }
29+
3230 if ( typeof config !== "string" ) {
3331 this . init ( config ) ;
3432 }
You can’t perform that action at this time.
0 commit comments