@@ -288,14 +288,17 @@ async function trimAndOptimizeFindOptions<M extends Model<any>>({
288288 return trimedFindOptions
289289}
290290
291- export default function createListResolver < M extends Model < any > > (
292- graphqlTypeDeclaration : ModelDeclarationType < M > ,
291+ export default function createListResolver <
292+ M extends Model < any > ,
293+ TContext = any
294+ > (
295+ graphqlTypeDeclaration : ModelDeclarationType < M , TContext > ,
293296 models : SequelizeModels ,
294297 globalPreCallback : any ,
295298 relation : ModelStatic < M > | null = null
296299) {
297300 if ( graphqlTypeDeclaration ?. list ?. resolver ) {
298- return async ( source : any , args : any , context : any , info : any ) => {
301+ return async ( source : any , args : any , context : TContext , info : any ) => {
299302 const customResolverHandle = globalPreCallback ( 'customListBefore' )
300303 if ( graphqlTypeDeclaration ?. list ?. resolver ) {
301304 const customResult = await graphqlTypeDeclaration . list . resolver (
@@ -328,7 +331,7 @@ export default function createListResolver<M extends Model<any>>(
328331 before : async (
329332 findOptions : FindOptions < M > ,
330333 args : any ,
331- context : any ,
334+ context : TContext ,
332335 info : any
333336 ) => {
334337 if ( ! findOptions . where ) {
@@ -370,7 +373,7 @@ export default function createListResolver<M extends Model<any>>(
370373
371374 // Global hooks, cannot impact the findOptions
372375 if ( graphqlTypeDeclaration . before ) {
373- const beforeList : GlobalBeforeHook [ ] =
376+ const beforeList : GlobalBeforeHook < TContext > [ ] =
374377 typeof graphqlTypeDeclaration . before . length !== 'undefined'
375378 ? ( graphqlTypeDeclaration . before as GlobalBeforeHook [ ] )
376379 : ( [
@@ -418,7 +421,7 @@ export default function createListResolver<M extends Model<any>>(
418421 args,
419422 } )
420423 } ,
421- after : async ( result : M | M [ ] , args : any , context : any , info : any ) => {
424+ after : async ( result : M | M [ ] , args : any , context : TContext , info : any ) => {
422425 if ( listAfter ) {
423426 const handle = globalPreCallback ( 'listAfter' )
424427 const modifiedResult = await listAfter ( {
0 commit comments