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";
11
11
export class Sequelize extends SequelizeOrigin implements BaseSequelize {
12
12
13
13
// to fix "$1" called with something that's not an instance of Sequelize.Model
14
- Model : any = Function ;
14
+ Model : any ;
15
15
16
- throughMap : { [ through : string ] : any } = { } ;
17
- _ : { [ modelName : string ] : typeof Model } = { } ;
16
+ throughMap : { [ through : string ] : any } ;
17
+ _ : { [ modelName : string ] : typeof Model } ;
18
18
init : ( config : SequelizeConfig ) => void ;
19
19
addModels : ( models : Array < typeof Model > | string [ ] ) => void ;
20
20
associateModels : ( models : Array < typeof Model > ) => void ;
21
21
22
22
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 ) )
34
29
}
35
30
31
+ this . throughMap = { }
32
+ this . _ = { }
33
+ this . Model = Function
34
+
36
35
if ( typeof config !== "string" ) {
37
36
this . init ( config ) ;
38
37
}
Original file line number Diff line number Diff line change @@ -9,26 +9,24 @@ import {ISequelizeAssociation} from "../../interfaces/ISequelizeAssociation";
9
9
10
10
export class Sequelize extends OriginSequelize implements BaseSequelize {
11
11
12
- throughMap : { [ through : string ] : any } = { } ;
13
- _ : { [ modelName : string ] : typeof Model } = { } ;
12
+ throughMap : { [ through : string ] : any } ;
13
+ _ : { [ modelName : string ] : typeof Model } ;
14
14
init : ( config : SequelizeConfig ) => void ;
15
15
addModels : ( models : Array < typeof Model > | string [ ] ) => void ;
16
16
associateModels : ( models : Array < typeof Model > ) => void ;
17
17
18
18
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 ) )
30
25
}
31
26
27
+ this . throughMap = { }
28
+ this . _ = { }
29
+
32
30
if ( typeof config !== "string" ) {
33
31
this . init ( config ) ;
34
32
}
You can’t perform that action at this time.
0 commit comments