@@ -13,17 +13,17 @@ type PaginationConfig = {
1313} ;
1414
1515/** 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 > {
1717 modelManager ! : AnyModelManager | InternalModelManager < Shape > ;
1818 pagination ! : PaginationConfig ;
1919
2020 /** 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 > > (
2222 modelManager : AnyModelManager | InternalModelManager < Shape > ,
23- records : GadgetRecord < Shape > [ ] ,
23+ records : RecordType [ ] ,
2424 pagination : PaginationConfig
2525 ) {
26- const list = new GadgetRecordList < Shape > ( ) ;
26+ const list = new GadgetRecordList < Shape , RecordType > ( ) ;
2727 list . push ( ...records ) ;
2828 list . modelManager = modelManager ;
2929 list . pagination = pagination ;
@@ -71,7 +71,7 @@ export class GadgetRecordList<Shape extends RecordShape> extends Array<GadgetRec
7171 ...options ,
7272 after : this . pagination . pageInfo . endCursor ,
7373 first : first || last ,
74- } ) as Promise < GadgetRecordList < Shape > > ;
74+ } ) as Promise < GadgetRecordList < Shape , RecordType > > ;
7575 return await nextPage ;
7676 }
7777
@@ -86,7 +86,7 @@ export class GadgetRecordList<Shape extends RecordShape> extends Array<GadgetRec
8686 ...options ,
8787 before : this . pagination . pageInfo . startCursor ,
8888 last : last || first ,
89- } ) as Promise < GadgetRecordList < Shape > > ;
89+ } ) as Promise < GadgetRecordList < Shape , RecordType > > ;
9090 return await prevPage ;
9191 }
9292}
0 commit comments