1
1
import { isNullish , isArray , assert } from '../support/Utils'
2
2
import { Element , Item , Collection } from '../data/Data'
3
+ import { Database } from '../database/Database'
3
4
import { Query } from '../query/Query'
4
5
import { NonEnumerable } from './decorators/NonEnumerable'
5
6
import { Attribute } from './attributes/Attribute'
@@ -13,7 +14,6 @@ import { HasOne } from './attributes/relations/HasOne'
13
14
import { BelongsTo } from './attributes/relations/BelongsTo'
14
15
import { HasMany } from './attributes/relations/HasMany'
15
16
import { HasManyBy } from './attributes/relations/HasManyBy'
16
- import { Database } from '@/database/Database'
17
17
18
18
export type ModelFields = Record < string , Attribute >
19
19
export type ModelSchemas = Record < string , ModelFields >
@@ -100,7 +100,11 @@ export class Model {
100
100
/**
101
101
* Set the attribute to the registry.
102
102
*/
103
- static setRegistry ( key : string , attribute : ( ) => Attribute ) : typeof Model {
103
+ static setRegistry < M extends typeof Model > (
104
+ this : M ,
105
+ key : string ,
106
+ attribute : ( ) => Attribute
107
+ ) : M {
104
108
if ( ! this . registries [ this . entity ] ) {
105
109
this . registries [ this . entity ] = { }
106
110
}
@@ -128,7 +132,7 @@ export class Model {
128
132
/**
129
133
* Create a new model instance without field values being populated.
130
134
*
131
- * This method is mainly fo the internal use when registering models to the
135
+ * This method is mainly for the internal use when registering models to the
132
136
* database. Since all pre-registered models are for referencing its model
133
137
* setting during the various process, but the fields are not required.
134
138
*
0 commit comments