@@ -125,7 +125,7 @@ export default function graphqlTypegenCore(
125125 ? j . tsTypeAnnotation ( typeAnnotation as any )
126126 : j . typeAnnotation ( typeAnnotation as any )
127127
128- const genericTypeAnnotation = (
128+ const typeReference = (
129129 id : IdentifierKind | QualifiedTypeIdentifier | TSQualifiedName ,
130130 typeParameters :
131131 | TypeParameterInstantiation
@@ -183,11 +183,11 @@ export default function graphqlTypegenCore(
183183 variables ?: TypeAlias | TSTypeAliasDeclaration | null | undefined
184184 ) : TypeParameterInstantiation | TSTypeParameterInstantiation {
185185 const params : ( FlowTypeKind | TSTypeKind ) [ ] = [
186- genericTypeAnnotation ( j . identifier ( data . id . name ) , null ) ,
186+ typeReference ( j . identifier ( data . id . name ) , null ) ,
187187 ]
188188 params . push (
189189 variables
190- ? genericTypeAnnotation ( j . identifier ( variables . id . name ) , null )
190+ ? typeReference ( j . identifier ( variables . id . name ) , null )
191191 : emptyObjectType ( )
192192 )
193193 return typeParameterInstantiation ( params )
@@ -197,14 +197,12 @@ export default function graphqlTypegenCore(
197197 data : TypeAlias | TSTypeAliasDeclaration ,
198198 variables ?: TypeAlias | TSTypeAliasDeclaration | null | undefined
199199 ) : TypeAnnotation | TSTypeAnnotation => {
200- const parameters = [ genericTypeAnnotation ( j . identifier ( data . id . name ) , null ) ]
200+ const parameters = [ typeReference ( j . identifier ( data . id . name ) , null ) ]
201201 if ( variables ) {
202- parameters . push (
203- genericTypeAnnotation ( j . identifier ( variables . id . name ) , null )
204- )
202+ parameters . push ( typeReference ( j . identifier ( variables . id . name ) , null ) )
205203 }
206204 return typeAnnotation (
207- genericTypeAnnotation (
205+ typeReference (
208206 j . identifier ( addQueryRenderProps ( ) ) ,
209207 typeParameterInstantiation ( parameters )
210208 )
@@ -216,12 +214,12 @@ export default function graphqlTypegenCore(
216214 variables ?: TypeAlias | TSTypeAliasDeclaration | null | undefined
217215 ) : TypeAnnotation | TSTypeAnnotation =>
218216 typeAnnotation (
219- genericTypeAnnotation (
217+ typeReference (
220218 j . identifier ( addQueryResult ( ) ) ,
221219 typeParameterInstantiation ( [
222- genericTypeAnnotation ( j . identifier ( data . id . name ) , null ) ,
220+ typeReference ( j . identifier ( data . id . name ) , null ) ,
223221 variables
224- ? genericTypeAnnotation ( j . identifier ( variables . id . name ) , null )
222+ ? typeReference ( j . identifier ( variables . id . name ) , null )
225223 : emptyObjectType ( ) ,
226224 ] )
227225 )
@@ -231,10 +229,10 @@ export default function graphqlTypegenCore(
231229 data : TypeAlias | TSTypeAliasDeclaration
232230 ) : TypeAnnotation | TSTypeAnnotation =>
233231 typeAnnotation (
234- genericTypeAnnotation (
232+ typeReference (
235233 j . identifier ( addMutationResult ( ) ) ,
236234 typeParameterInstantiation ( [
237- genericTypeAnnotation ( j . identifier ( data . id . name ) , null ) ,
235+ typeReference ( j . identifier ( data . id . name ) , null ) ,
238236 ] )
239237 )
240238 )
@@ -244,12 +242,12 @@ export default function graphqlTypegenCore(
244242 variables ?: TypeAlias | TSTypeAliasDeclaration | null | undefined
245243 ) : TypeAnnotation | TSTypeAnnotation =>
246244 typeAnnotation (
247- genericTypeAnnotation (
245+ typeReference (
248246 j . identifier ( addMutationFunction ( ) ) ,
249247 typeParameterInstantiation ( [
250- genericTypeAnnotation ( j . identifier ( data . id . name ) , null ) ,
248+ typeReference ( j . identifier ( data . id . name ) , null ) ,
251249 variables
252- ? genericTypeAnnotation ( j . identifier ( variables . id . name ) , null )
250+ ? typeReference ( j . identifier ( variables . id . name ) , null )
253251 : emptyObjectType ( ) ,
254252 ] )
255253 )
@@ -259,10 +257,10 @@ export default function graphqlTypegenCore(
259257 data : TypeAlias | TSTypeAliasDeclaration
260258 ) : TypeAnnotation | TSTypeAnnotation =>
261259 typeAnnotation (
262- genericTypeAnnotation (
260+ typeReference (
263261 j . identifier ( addSubscriptionResult ( ) ) ,
264262 typeParameterInstantiation ( [
265- genericTypeAnnotation ( j . identifier ( data . id . name ) , null ) ,
263+ typeReference ( j . identifier ( data . id . name ) , null ) ,
266264 ] )
267265 )
268266 )
@@ -485,7 +483,7 @@ export default function graphqlTypegenCore(
485483 typeCast (
486484 variablesValue . value ,
487485 typeAnnotation (
488- genericTypeAnnotation ( j . identifier ( variables . id . name ) , null )
486+ typeReference ( j . identifier ( variables . id . name ) , null )
489487 )
490488 )
491489 )
@@ -547,10 +545,7 @@ export default function graphqlTypegenCore(
547545 if ( firstParam && firstParam . node . type === 'Identifier' ) {
548546 firstParam . node . typeAnnotation = mutationFunction
549547 ? typeAnnotation (
550- genericTypeAnnotation (
551- j . identifier ( mutationFunction . id . name ) ,
552- null
553- )
548+ typeReference ( j . identifier ( mutationFunction . id . name ) , null )
554549 )
555550 : mutationFunctionAnnotation ( data , variables )
556551 }
@@ -609,7 +604,7 @@ export default function graphqlTypegenCore(
609604 variablesProp . value = typeCast (
610605 variablesProp . value as ExpressionKind ,
611606 typeAnnotation (
612- genericTypeAnnotation ( j . identifier ( variables . id . name ) , null )
607+ typeReference ( j . identifier ( variables . id . name ) , null )
613608 )
614609 )
615610 }
@@ -649,10 +644,7 @@ export default function graphqlTypegenCore(
649644 if ( ! mutationFunction ) return
650645 if ( id . type !== 'ArrayPattern' && id . type !== 'Identifier' ) return
651646 const tupleTypes : ( FlowTypeKind | TSTypeKind ) [ ] = [
652- genericTypeAnnotation (
653- j . identifier ( mutationFunction . id . name ) ,
654- null
655- ) ,
647+ typeReference ( j . identifier ( mutationFunction . id . name ) , null ) ,
656648 ]
657649 if ( data && id . type === 'ArrayPattern' && id . elements . length > 1 ) {
658650 const resultType = mutationResultAnnotation ( data ) . typeAnnotation
@@ -724,7 +716,7 @@ export default function graphqlTypegenCore(
724716 variablesProp . value = typeCast (
725717 variablesProp . value as ExpressionKind ,
726718 typeAnnotation (
727- genericTypeAnnotation ( j . identifier ( variables . id . name ) , null )
719+ typeReference ( j . identifier ( variables . id . name ) , null )
728720 )
729721 )
730722 }
0 commit comments