@@ -38,9 +38,10 @@ import { Subschema } from './Subschema';
38
38
import { createRequest , getDelegatingOperation } from './createRequest' ;
39
39
import { Transformer } from './Transformer' ;
40
40
41
- export function delegateToSchema < TContext = Record < string , any > , TArgs = any > (
42
- options : IDelegateToSchemaOptions < TContext , TArgs >
43
- ) : any {
41
+ export function delegateToSchema <
42
+ TContext extends Record < string , any > = Record < string , any > ,
43
+ TArgs extends Record < string , any > = any
44
+ > ( options : IDelegateToSchemaOptions < TContext , TArgs > ) : any {
44
45
const {
45
46
info,
46
47
schema,
@@ -85,9 +86,10 @@ function getDelegationReturnType(
85
86
return rootType . getFields ( ) [ fieldName ] . type ;
86
87
}
87
88
88
- export function delegateRequest < TContext = Record < string , any > , TArgs = any > (
89
- options : IDelegateRequestOptions < TContext , TArgs >
90
- ) {
89
+ export function delegateRequest <
90
+ TContext extends Record < string , any > = Record < string , any > ,
91
+ TArgs extends Record < string , any > = any
92
+ > ( options : IDelegateRequestOptions < TContext , TArgs > ) {
91
93
const delegationContext = getDelegationContext ( options ) ;
92
94
93
95
const transformer = new Transformer < TContext > ( delegationContext ) ;
@@ -112,7 +114,7 @@ export function delegateRequest<TContext = Record<string, any>, TArgs = any>(
112
114
. resolve ( ) ;
113
115
}
114
116
115
- function getDelegationContext < TContext > ( {
117
+ function getDelegationContext < TContext extends Record < string , any > > ( {
116
118
request,
117
119
schema,
118
120
fieldName,
@@ -193,7 +195,9 @@ function validateRequest(delegationContext: DelegationContext<any>, document: Do
193
195
194
196
const GLOBAL_CONTEXT = { } ;
195
197
196
- function getExecutor < TContext > ( delegationContext : DelegationContext < TContext > ) : Executor < TContext > {
198
+ function getExecutor < TContext extends Record < string , any > > (
199
+ delegationContext : DelegationContext < TContext >
200
+ ) : Executor < TContext > {
197
201
const { subschemaConfig, targetSchema, context } = delegationContext ;
198
202
199
203
let executor : Executor = subschemaConfig ?. executor || createDefaultExecutor ( targetSchema ) ;
0 commit comments