@@ -13,17 +13,17 @@ type PaginationConfig = {
13
13
} ;
14
14
15
15
/** Represents a list of objects returned from the API. Facilitates iterating and paginating. */
16
- export class GadgetRecordList < Shape extends RecordShape > extends Array < GadgetRecord < Shape > > {
16
+ export class GadgetRecordList < Shape extends RecordShape , RecordType extends GadgetRecord < Shape > = GadgetRecord < any > > extends Array < RecordType > {
17
17
modelManager ! : AnyModelManager | InternalModelManager < Shape > ;
18
18
pagination ! : PaginationConfig ;
19
19
20
20
/** Internal method used to create a list. Should not be used by applications. */
21
- static boot < Shape extends RecordShape > (
21
+ static boot < Shape extends RecordShape , RecordType extends GadgetRecord < Shape > = GadgetRecord < any > > (
22
22
modelManager : AnyModelManager | InternalModelManager < Shape > ,
23
- records : GadgetRecord < Shape > [ ] ,
23
+ records : RecordType [ ] ,
24
24
pagination : PaginationConfig
25
25
) {
26
- const list = new GadgetRecordList < Shape > ( ) ;
26
+ const list = new GadgetRecordList < Shape , RecordType > ( ) ;
27
27
list . push ( ...records ) ;
28
28
list . modelManager = modelManager ;
29
29
list . pagination = pagination ;
@@ -71,7 +71,7 @@ export class GadgetRecordList<Shape extends RecordShape> extends Array<GadgetRec
71
71
...options ,
72
72
after : this . pagination . pageInfo . endCursor ,
73
73
first : first || last ,
74
- } ) as Promise < GadgetRecordList < Shape > > ;
74
+ } ) as Promise < GadgetRecordList < Shape , RecordType > > ;
75
75
return await nextPage ;
76
76
}
77
77
@@ -86,7 +86,7 @@ export class GadgetRecordList<Shape extends RecordShape> extends Array<GadgetRec
86
86
...options ,
87
87
before : this . pagination . pageInfo . startCursor ,
88
88
last : last || first ,
89
- } ) as Promise < GadgetRecordList < Shape > > ;
89
+ } ) as Promise < GadgetRecordList < Shape , RecordType > > ;
90
90
return await prevPage ;
91
91
}
92
92
}
0 commit comments