This repository was archived by the owner on Sep 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -465,6 +465,16 @@ function groupRefs(props: Selection[]): Selection[] {
465
465
return result ;
466
466
}
467
467
468
+ function createAnyTypeAlias ( name : string ) : ts . TypeAliasDeclaration {
469
+ return ts . createTypeAliasDeclaration (
470
+ undefined ,
471
+ undefined ,
472
+ ts . createIdentifier ( name ) ,
473
+ undefined ,
474
+ ts . createKeywordTypeNode ( ts . SyntaxKind . AnyKeyword )
475
+ ) ;
476
+ }
477
+
468
478
function getFragmentImports ( state : State ) {
469
479
const imports : ts . Statement [ ] = [ ] ;
470
480
if ( state . usedFragments . size > 0 ) {
@@ -487,6 +497,10 @@ function getFragmentImports(state: State) {
487
497
relativeReference + path . join ( relative , usedFragment + ".graphql" )
488
498
)
489
499
) ;
500
+ } else {
501
+ imports . push (
502
+ createAnyTypeAlias ( refTypeName ) ,
503
+ ) ;
490
504
}
491
505
}
492
506
}
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ fragment ConcreateTypes on Viewer {
64
64
}
65
65
66
66
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
67
+ type OtherFragment_ref = any;
68
+ type PictureFragment_ref = any;
69
+ type UserFrag1_ref = any;
70
+ type UserFrag2_ref = any;
67
71
import { FragmentReference } from "relay-runtime";
68
72
export enum FragmentSpread_ref {
69
73
}
@@ -81,6 +85,7 @@ export type FragmentSpread = {
81
85
} ;
82
86
83
87
88
+ type PageFragment_ref = any;
84
89
import { FragmentReference } from "relay-runtime";
85
90
export enum ConcreateTypes_ref {
86
91
}
@@ -205,6 +210,7 @@ export type InlineFragmentConditionalID = {
205
210
} ;
206
211
207
212
213
+ type SomeFragment_ref = any;
208
214
import { FragmentReference } from "relay-runtime";
209
215
export enum InlineFragmentKitchenSink_ref {
210
216
}
@@ -675,6 +681,7 @@ fragment AnotherRecursiveFragment on Image {
675
681
}
676
682
677
683
~~~~~~~~~~ OUTPUT ~~~~~~~~~~
684
+ type PhotoFragment_ref = any;
678
685
import { FragmentReference } from "relay-runtime";
679
686
export enum UserProfile_ref {
680
687
}
You can’t perform that action at this time.
0 commit comments