File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1423,6 +1423,19 @@ declare namespace Objection {
1423
1423
new ( ) : T ;
1424
1424
}
1425
1425
1426
+ interface PrototypeType < T > extends Function {
1427
+ prototype : T ;
1428
+ }
1429
+
1430
+ interface ConstructorFunctionType < T = any > extends PrototypeType < T > {
1431
+ new ( ...args : any [ ] ) : T ;
1432
+ }
1433
+
1434
+ // for internal use on generic static this deduction, copied from https://github.com/microsoft/TypeScript/issues/5863#issuecomment-1483978415
1435
+ type ConstructorType < T = unknown , Static extends Record < string , any > = PrototypeType < T > > = ( ConstructorFunctionType < T > | PrototypeType < T > ) & {
1436
+ [ Key in keyof Static ] : Static [ Key ] ;
1437
+ } ;
1438
+
1426
1439
export interface ModelConstructor < M extends Model > extends Constructor < M > { }
1427
1440
1428
1441
export interface ModelClass < M extends Model > extends ModelConstructor < M > {
@@ -1573,7 +1586,7 @@ declare namespace Objection {
1573
1586
) : QueryBuilderType < M > ;
1574
1587
1575
1588
static relatedQuery < M extends Model , K extends keyof M > (
1576
- this : Constructor < M > ,
1589
+ this : ConstructorType < M > ,
1577
1590
relationName : K ,
1578
1591
trxOrKnex ?: TransactionOrKnex ,
1579
1592
) : ArrayRelatedQueryBuilder < M [ K ] > ;
You can’t perform that action at this time.
0 commit comments