Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit 3c39720

Browse files
committed
Keep order of op types as it was so changes aren't so jarring.
1 parent 1d0981d commit 3c39720

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

src/TypeScriptGenerator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,13 @@ function createVisitor(options: TypeGeneratorOptions): IRVisitor.NodeVisitor {
360360
)
361361
);
362362
const operationTypes = [
363-
readOnlyObjectTypeProperty(
364-
"variables",
365-
ts.createTypeReferenceNode(inputVariablesType.name, undefined)
366-
),
367363
readOnlyObjectTypeProperty(
368364
"response",
369365
ts.createTypeReferenceNode(responseType.name, undefined)
366+
),
367+
readOnlyObjectTypeProperty(
368+
"variables",
369+
ts.createTypeReferenceNode(inputVariablesType.name, undefined)
370370
)
371371
];
372372
// Generate raw response type

test/__snapshots__/TypeScriptGenerator-test.ts.snap

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ export type QueryWithConnectionFieldResponse = {
6666
} | null;
6767
};
6868
export type QueryWithConnectionField = {
69-
readonly variables: QueryWithConnectionFieldVariables;
7069
readonly response: QueryWithConnectionFieldResponse;
70+
readonly variables: QueryWithConnectionFieldVariables;
7171
};
7272
7373
@@ -457,8 +457,8 @@ export type UnionTypeTestResponse = {
457457
}) | null;
458458
};
459459
export type UnionTypeTest = {
460-
readonly variables: UnionTypeTestVariables;
461460
readonly response: UnionTypeTestResponse;
461+
readonly variables: UnionTypeTestVariables;
462462
};
463463
464464
`;
@@ -571,8 +571,8 @@ export type NameRendererQueryResponse = {
571571
} | null;
572572
};
573573
export type NameRendererQuery = {
574-
readonly variables: NameRendererQueryVariables;
575574
readonly response: NameRendererQueryResponse;
575+
readonly variables: NameRendererQueryVariables;
576576
};
577577
578578
@@ -650,8 +650,8 @@ export type TestRawResponse = {
650650
}) | null;
651651
};
652652
export type Test = {
653-
readonly variables: TestVariables;
654653
readonly response: TestResponse;
654+
readonly variables: TestVariables;
655655
readonly rawResponse: TestRawResponse;
656656
};
657657
@@ -741,8 +741,8 @@ export type TestMutationRawResponse = {
741741
}) | null;
742742
};
743743
export type TestMutation = {
744-
readonly variables: TestMutationVariables;
745744
readonly response: TestMutationResponse;
745+
readonly variables: TestMutationVariables;
746746
readonly rawResponse: TestMutationRawResponse;
747747
};
748748
@@ -812,8 +812,8 @@ export type CommentCreateMutationResponse = {
812812
} | null;
813813
};
814814
export type CommentCreateMutation = {
815-
readonly variables: CommentCreateMutationVariables;
816815
readonly response: CommentCreateMutationResponse;
816+
readonly variables: CommentCreateMutationVariables;
817817
};
818818
819819
`;
@@ -853,8 +853,8 @@ export type InputHasArrayRawResponse = {
853853
}) | null;
854854
};
855855
export type InputHasArray = {
856-
readonly variables: InputHasArrayVariables;
857856
readonly response: InputHasArrayResponse;
857+
readonly variables: InputHasArrayVariables;
858858
readonly rawResponse: InputHasArrayRawResponse;
859859
};
860860
@@ -946,8 +946,8 @@ export type CommentCreateMutationRawResponse = {
946946
}) | null;
947947
};
948948
export type CommentCreateMutation = {
949-
readonly variables: CommentCreateMutationVariables;
950949
readonly response: CommentCreateMutationResponse;
950+
readonly variables: CommentCreateMutationVariables;
951951
readonly rawResponse: CommentCreateMutationRawResponse;
952952
};
953953
@@ -1055,8 +1055,8 @@ export type CommentCreateMutationRawResponse = {
10551055
}) | null;
10561056
};
10571057
export type CommentCreateMutation = {
1058-
readonly variables: CommentCreateMutationVariables;
10591058
readonly response: CommentCreateMutationResponse;
1059+
readonly variables: CommentCreateMutationVariables;
10601060
readonly rawResponse: CommentCreateMutationRawResponse;
10611061
};
10621062
@@ -1158,8 +1158,8 @@ export type TestDeferRawResponse = {
11581158
}) | null;
11591159
};
11601160
export type TestDefer = {
1161-
readonly variables: TestDeferVariables;
11621161
readonly response: TestDeferResponse;
1162+
readonly variables: TestDeferVariables;
11631163
readonly rawResponse: TestDeferRawResponse;
11641164
};
11651165
@@ -1210,8 +1210,8 @@ export type LinkedHandleFieldRawResponse = {
12101210
}) | null;
12111211
};
12121212
export type LinkedHandleField = {
1213-
readonly variables: LinkedHandleFieldVariables;
12141213
readonly response: LinkedHandleFieldResponse;
1214+
readonly variables: LinkedHandleFieldVariables;
12151215
readonly rawResponse: LinkedHandleFieldRawResponse;
12161216
};
12171217
@@ -1236,8 +1236,8 @@ export type ScalarHandleFieldRawResponse = {
12361236
}) | null;
12371237
};
12381238
export type ScalarHandleField = {
1239-
readonly variables: ScalarHandleFieldVariables;
12401239
readonly response: ScalarHandleFieldResponse;
1240+
readonly variables: ScalarHandleFieldVariables;
12411241
readonly rawResponse: ScalarHandleFieldRawResponse;
12421242
};
12431243
@@ -1290,8 +1290,8 @@ export type ExampleQueryRawResponse = {
12901290
}) | null;
12911291
};
12921292
export type ExampleQuery = {
1293-
readonly variables: ExampleQueryVariables;
12941293
readonly response: ExampleQueryResponse;
1294+
readonly variables: ExampleQueryVariables;
12951295
readonly rawResponse: ExampleQueryRawResponse;
12961296
};
12971297
@@ -1371,8 +1371,8 @@ export type TestStreamRawResponse = {
13711371
}) | null;
13721372
};
13731373
export type TestStream = {
1374-
readonly variables: TestStreamVariables;
13751374
readonly response: TestStreamResponse;
1375+
readonly variables: TestStreamVariables;
13761376
readonly rawResponse: TestStreamRawResponse;
13771377
};
13781378
@@ -1435,8 +1435,8 @@ export type RefetchableFragmentQueryResponse = {
14351435
} | null;
14361436
};
14371437
export type RefetchableFragmentQuery = {
1438-
readonly variables: RefetchableFragmentQueryVariables;
14391438
readonly response: RefetchableFragmentQueryResponse;
1439+
readonly variables: RefetchableFragmentQueryVariables;
14401440
};
14411441
14421442
`;
@@ -1480,8 +1480,8 @@ export type ExampleQueryResponse = {
14801480
} | null;
14811481
};
14821482
export type ExampleQuery = {
1483-
readonly variables: ExampleQueryVariables;
14841483
readonly response: ExampleQueryResponse;
1484+
readonly variables: ExampleQueryVariables;
14851485
};
14861486
14871487
@@ -1517,8 +1517,8 @@ export type TestMutationResponse = {
15171517
} | null;
15181518
};
15191519
export type TestMutation = {
1520-
readonly variables: TestMutationVariables;
15211520
readonly response: TestMutationResponse;
1521+
readonly variables: TestMutationVariables;
15221522
};
15231523
15241524
@@ -1538,8 +1538,8 @@ export type TestSubscriptionResponse = {
15381538
} | null;
15391539
};
15401540
export type TestSubscription = {
1541-
readonly variables: TestSubscriptionVariables;
15421541
readonly response: TestSubscriptionResponse;
1542+
readonly variables: TestSubscriptionVariables;
15431543
};
15441544
15451545
`;
@@ -1980,8 +1980,8 @@ export type QueryWithConnectionFieldResponse = {
19801980
} | null;
19811981
};
19821982
export type QueryWithConnectionField = {
1983-
readonly variables: QueryWithConnectionFieldVariables;
19841983
readonly response: QueryWithConnectionFieldResponse;
1984+
readonly variables: QueryWithConnectionFieldVariables;
19851985
};
19861986
19871987
@@ -2357,8 +2357,8 @@ export type UnionTypeTestResponse = {
23572357
}) | null;
23582358
};
23592359
export type UnionTypeTest = {
2360-
readonly variables: UnionTypeTestVariables;
23612360
readonly response: UnionTypeTestResponse;
2361+
readonly variables: UnionTypeTestVariables;
23622362
};
23632363
23642364
`;
@@ -2468,8 +2468,8 @@ export type NameRendererQueryResponse = {
24682468
} | null;
24692469
};
24702470
export type NameRendererQuery = {
2471-
readonly variables: NameRendererQueryVariables;
24722471
readonly response: NameRendererQueryResponse;
2472+
readonly variables: NameRendererQueryVariables;
24732473
};
24742474
24752475
@@ -2545,8 +2545,8 @@ export type TestRawResponse = {
25452545
}) | null;
25462546
};
25472547
export type Test = {
2548-
readonly variables: TestVariables;
25492548
readonly response: TestResponse;
2549+
readonly variables: TestVariables;
25502550
readonly rawResponse: TestRawResponse;
25512551
};
25522552
@@ -2636,8 +2636,8 @@ export type TestMutationRawResponse = {
26362636
}) | null;
26372637
};
26382638
export type TestMutation = {
2639-
readonly variables: TestMutationVariables;
26402639
readonly response: TestMutationResponse;
2640+
readonly variables: TestMutationVariables;
26412641
readonly rawResponse: TestMutationRawResponse;
26422642
};
26432643
@@ -2706,8 +2706,8 @@ export type CommentCreateMutationResponse = {
27062706
} | null;
27072707
};
27082708
export type CommentCreateMutation = {
2709-
readonly variables: CommentCreateMutationVariables;
27102709
readonly response: CommentCreateMutationResponse;
2710+
readonly variables: CommentCreateMutationVariables;
27112711
};
27122712
27132713
`;
@@ -2747,8 +2747,8 @@ export type InputHasArrayRawResponse = {
27472747
}) | null;
27482748
};
27492749
export type InputHasArray = {
2750-
readonly variables: InputHasArrayVariables;
27512750
readonly response: InputHasArrayResponse;
2751+
readonly variables: InputHasArrayVariables;
27522752
readonly rawResponse: InputHasArrayRawResponse;
27532753
};
27542754
@@ -2840,8 +2840,8 @@ export type CommentCreateMutationRawResponse = {
28402840
}) | null;
28412841
};
28422842
export type CommentCreateMutation = {
2843-
readonly variables: CommentCreateMutationVariables;
28442843
readonly response: CommentCreateMutationResponse;
2844+
readonly variables: CommentCreateMutationVariables;
28452845
readonly rawResponse: CommentCreateMutationRawResponse;
28462846
};
28472847
@@ -2948,8 +2948,8 @@ export type CommentCreateMutationRawResponse = {
29482948
}) | null;
29492949
};
29502950
export type CommentCreateMutation = {
2951-
readonly variables: CommentCreateMutationVariables;
29522951
readonly response: CommentCreateMutationResponse;
2952+
readonly variables: CommentCreateMutationVariables;
29532953
readonly rawResponse: CommentCreateMutationRawResponse;
29542954
};
29552955
@@ -3048,8 +3048,8 @@ export type TestDeferRawResponse = {
30483048
}) | null;
30493049
};
30503050
export type TestDefer = {
3051-
readonly variables: TestDeferVariables;
30523051
readonly response: TestDeferResponse;
3052+
readonly variables: TestDeferVariables;
30533053
readonly rawResponse: TestDeferRawResponse;
30543054
};
30553055
@@ -3100,8 +3100,8 @@ export type LinkedHandleFieldRawResponse = {
31003100
}) | null;
31013101
};
31023102
export type LinkedHandleField = {
3103-
readonly variables: LinkedHandleFieldVariables;
31043103
readonly response: LinkedHandleFieldResponse;
3104+
readonly variables: LinkedHandleFieldVariables;
31053105
readonly rawResponse: LinkedHandleFieldRawResponse;
31063106
};
31073107
@@ -3126,8 +3126,8 @@ export type ScalarHandleFieldRawResponse = {
31263126
}) | null;
31273127
};
31283128
export type ScalarHandleField = {
3129-
readonly variables: ScalarHandleFieldVariables;
31303129
readonly response: ScalarHandleFieldResponse;
3130+
readonly variables: ScalarHandleFieldVariables;
31313131
readonly rawResponse: ScalarHandleFieldRawResponse;
31323132
};
31333133
@@ -3180,8 +3180,8 @@ export type ExampleQueryRawResponse = {
31803180
}) | null;
31813181
};
31823182
export type ExampleQuery = {
3183-
readonly variables: ExampleQueryVariables;
31843183
readonly response: ExampleQueryResponse;
3184+
readonly variables: ExampleQueryVariables;
31853185
readonly rawResponse: ExampleQueryRawResponse;
31863186
};
31873187
@@ -3260,8 +3260,8 @@ export type TestStreamRawResponse = {
32603260
}) | null;
32613261
};
32623262
export type TestStream = {
3263-
readonly variables: TestStreamVariables;
32643263
readonly response: TestStreamResponse;
3264+
readonly variables: TestStreamVariables;
32653265
readonly rawResponse: TestStreamRawResponse;
32663266
};
32673267
@@ -3321,8 +3321,8 @@ export type RefetchableFragmentQueryResponse = {
33213321
} | null;
33223322
};
33233323
export type RefetchableFragmentQuery = {
3324-
readonly variables: RefetchableFragmentQueryVariables;
33253324
readonly response: RefetchableFragmentQueryResponse;
3325+
readonly variables: RefetchableFragmentQueryVariables;
33263326
};
33273327
33283328
`;
@@ -3366,8 +3366,8 @@ export type ExampleQueryResponse = {
33663366
} | null;
33673367
};
33683368
export type ExampleQuery = {
3369-
readonly variables: ExampleQueryVariables;
33703369
readonly response: ExampleQueryResponse;
3370+
readonly variables: ExampleQueryVariables;
33713371
};
33723372
33733373
@@ -3402,8 +3402,8 @@ export type TestMutationResponse = {
34023402
} | null;
34033403
};
34043404
export type TestMutation = {
3405-
readonly variables: TestMutationVariables;
34063405
readonly response: TestMutationResponse;
3406+
readonly variables: TestMutationVariables;
34073407
};
34083408
34093409
@@ -3423,8 +3423,8 @@ export type TestSubscriptionResponse = {
34233423
} | null;
34243424
};
34253425
export type TestSubscription = {
3426-
readonly variables: TestSubscriptionVariables;
34273426
readonly response: TestSubscriptionResponse;
3427+
readonly variables: TestSubscriptionVariables;
34283428
};
34293429
34303430
`;

0 commit comments

Comments
 (0)