Skip to content

Commit bfda71e

Browse files
committed
move FragmentRefs out to @types/relay-runtime
1 parent 084745b commit bfda71e

17 files changed

+1403
-1356
lines changed

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
__snapshots__/
2-
fixtures/
2+
fixtures/
3+
example/ts/__relay_artifacts
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/node_modules/@types/relay-runtime/index.d.ts b/node_modules/@types/relay-runtime/index.d.ts
2-
index 18ff05e..3cd7622 100644
2+
index 18ff05e..1ab09b6 100644
33
--- a/node_modules/@types/relay-runtime/index.d.ts
44
+++ b/node_modules/@types/relay-runtime/index.d.ts
5-
@@ -193,12 +193,14 @@ export { createRelayNetworkLogger } from './lib/network/createRelayNetworkLogger
5+
@@ -193,12 +193,20 @@ export { createRelayNetworkLogger } from './lib/network/createRelayNetworkLogger
66
export { deepFreeze } from './lib/util/deepFreeze';
77

88
// These match the output of relay-compiler-language-typescript.
@@ -13,12 +13,18 @@ index 18ff05e..3cd7622 100644
1313
}
1414
-export interface _FragmentRefs<T> {
1515
- ' $fragmentRefs': T;
16-
+export interface _FragmentRefs<T extends string> {
17-
+ " $fragmentRefs": { [k in T]: true }
16+
+
17+
+export type FragmentRefs<Refs extends string> = {
18+
+ [ref in Refs]: true
19+
+}
20+
+
21+
+export interface _FragmentRefs<Refs extends string> {
22+
+ " $fragmentRefs": FragmentRefs<Refs>
1823
}
1924

2025
// This is a utility type for converting from a data type to a fragment reference that will resolve to that data type.
2126
-export type FragmentRef<T> = T extends _RefType<infer U> ? _FragmentRefs<U> : never;
2227
+export type FragmentRef<T> = T extends _RefType<infer U>
2328
+ ? _FragmentRefs<U>
2429
+ : never;
30+
+
Lines changed: 146 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
/* tslint:disable */
22

3-
import { ConcreteRequest } from "relay-runtime"
3+
import { ConcreteRequest } from "relay-runtime";
44
export type AddTodoInput = {
5-
readonly text: string
6-
readonly clientMutationId?: string | null
7-
}
5+
readonly text: string;
6+
readonly clientMutationId?: string | null;
7+
};
88
export type AddTodoMutationVariables = {
9-
readonly input: AddTodoInput
10-
}
9+
readonly input: AddTodoInput;
10+
};
1111
export type AddTodoMutationResponse = {
12-
readonly addTodo: {
13-
readonly todoEdge: {
14-
readonly __typename: string
15-
readonly cursor: string
16-
readonly node: {
17-
readonly complete: boolean | null
18-
readonly id: string
19-
readonly text: string | null
20-
} | null
21-
} | null
22-
readonly viewer: {
23-
readonly id: string
24-
readonly totalCount: number | null
25-
} | null
26-
} | null
27-
}
12+
readonly addTodo: {
13+
readonly todoEdge: {
14+
readonly __typename: string;
15+
readonly cursor: string;
16+
readonly node: {
17+
readonly complete: boolean | null;
18+
readonly id: string;
19+
readonly text: string | null;
20+
} | null;
21+
} | null;
22+
readonly viewer: {
23+
readonly id: string;
24+
readonly totalCount: number | null;
25+
} | null;
26+
} | null;
27+
};
2828
export type AddTodoMutation = {
29-
readonly response: AddTodoMutationResponse
30-
readonly variables: AddTodoMutationVariables
31-
}
29+
readonly response: AddTodoMutationResponse;
30+
readonly variables: AddTodoMutationVariables;
31+
};
32+
33+
3234

3335
/*
3436
mutation AddTodoMutation(
@@ -52,136 +54,135 @@ mutation AddTodoMutation(
5254
}
5355
*/
5456

55-
const node: ConcreteRequest = (function() {
56-
var v0 = [
57+
const node: ConcreteRequest = (function(){
58+
var v0 = [
59+
{
60+
"kind": "LocalArgument",
61+
"name": "input",
62+
"type": "AddTodoInput!",
63+
"defaultValue": null
64+
}
65+
],
66+
v1 = {
67+
"kind": "ScalarField",
68+
"alias": null,
69+
"name": "id",
70+
"args": null,
71+
"storageKey": null
72+
},
73+
v2 = [
74+
{
75+
"kind": "LinkedField",
76+
"alias": null,
77+
"name": "addTodo",
78+
"storageKey": null,
79+
"args": [
5780
{
58-
kind: "LocalArgument",
59-
name: "input",
60-
type: "AddTodoInput!",
61-
defaultValue: null,
62-
},
81+
"kind": "Variable",
82+
"name": "input",
83+
"variableName": "input"
84+
}
6385
],
64-
v1 = {
65-
kind: "ScalarField",
66-
alias: null,
67-
name: "id",
68-
args: null,
69-
storageKey: null,
70-
},
71-
v2 = [
86+
"concreteType": "AddTodoPayload",
87+
"plural": false,
88+
"selections": [
7289
{
73-
kind: "LinkedField",
74-
alias: null,
75-
name: "addTodo",
76-
storageKey: null,
77-
args: [
90+
"kind": "LinkedField",
91+
"alias": null,
92+
"name": "todoEdge",
93+
"storageKey": null,
94+
"args": null,
95+
"concreteType": "TodoEdge",
96+
"plural": false,
97+
"selections": [
7898
{
79-
kind: "Variable",
80-
name: "input",
81-
variableName: "input",
99+
"kind": "ScalarField",
100+
"alias": null,
101+
"name": "__typename",
102+
"args": null,
103+
"storageKey": null
82104
},
83-
],
84-
concreteType: "AddTodoPayload",
85-
plural: false,
86-
selections: [
87105
{
88-
kind: "LinkedField",
89-
alias: null,
90-
name: "todoEdge",
91-
storageKey: null,
92-
args: null,
93-
concreteType: "TodoEdge",
94-
plural: false,
95-
selections: [
96-
{
97-
kind: "ScalarField",
98-
alias: null,
99-
name: "__typename",
100-
args: null,
101-
storageKey: null,
102-
},
103-
{
104-
kind: "ScalarField",
105-
alias: null,
106-
name: "cursor",
107-
args: null,
108-
storageKey: null,
109-
},
110-
{
111-
kind: "LinkedField",
112-
alias: null,
113-
name: "node",
114-
storageKey: null,
115-
args: null,
116-
concreteType: "Todo",
117-
plural: false,
118-
selections: [
119-
{
120-
kind: "ScalarField",
121-
alias: null,
122-
name: "complete",
123-
args: null,
124-
storageKey: null,
125-
},
126-
v1 /*: any*/,
127-
{
128-
kind: "ScalarField",
129-
alias: null,
130-
name: "text",
131-
args: null,
132-
storageKey: null,
133-
},
134-
],
135-
},
136-
],
106+
"kind": "ScalarField",
107+
"alias": null,
108+
"name": "cursor",
109+
"args": null,
110+
"storageKey": null
137111
},
138112
{
139-
kind: "LinkedField",
140-
alias: null,
141-
name: "viewer",
142-
storageKey: null,
143-
args: null,
144-
concreteType: "User",
145-
plural: false,
146-
selections: [
147-
v1 /*: any*/,
113+
"kind": "LinkedField",
114+
"alias": null,
115+
"name": "node",
116+
"storageKey": null,
117+
"args": null,
118+
"concreteType": "Todo",
119+
"plural": false,
120+
"selections": [
148121
{
149-
kind: "ScalarField",
150-
alias: null,
151-
name: "totalCount",
152-
args: null,
153-
storageKey: null,
122+
"kind": "ScalarField",
123+
"alias": null,
124+
"name": "complete",
125+
"args": null,
126+
"storageKey": null
154127
},
155-
],
156-
},
157-
],
128+
(v1/*: any*/),
129+
{
130+
"kind": "ScalarField",
131+
"alias": null,
132+
"name": "text",
133+
"args": null,
134+
"storageKey": null
135+
}
136+
]
137+
}
138+
]
158139
},
140+
{
141+
"kind": "LinkedField",
142+
"alias": null,
143+
"name": "viewer",
144+
"storageKey": null,
145+
"args": null,
146+
"concreteType": "User",
147+
"plural": false,
148+
"selections": [
149+
(v1/*: any*/),
150+
{
151+
"kind": "ScalarField",
152+
"alias": null,
153+
"name": "totalCount",
154+
"args": null,
155+
"storageKey": null
156+
}
157+
]
158+
}
159159
]
160-
return {
161-
kind: "Request",
162-
fragment: {
163-
kind: "Fragment",
164-
name: "AddTodoMutation",
165-
type: "Mutation",
166-
metadata: null,
167-
argumentDefinitions: v0 /*: any*/,
168-
selections: v2 /*: any*/,
169-
},
170-
operation: {
171-
kind: "Operation",
172-
name: "AddTodoMutation",
173-
argumentDefinitions: v0 /*: any*/,
174-
selections: v2 /*: any*/,
175-
},
176-
params: {
177-
operationKind: "mutation",
178-
name: "AddTodoMutation",
179-
id: null,
180-
text:
181-
"mutation AddTodoMutation(\n $input: AddTodoInput!\n) {\n addTodo(input: $input) {\n todoEdge {\n __typename\n cursor\n node {\n complete\n id\n text\n }\n }\n viewer {\n id\n totalCount\n }\n }\n}\n",
182-
metadata: {},
183-
},
184160
}
185-
})()
186-
;(node as any).hash = "d83bc4fc4eabb0be2a540834905e9427"
187-
export default node
161+
];
162+
return {
163+
"kind": "Request",
164+
"fragment": {
165+
"kind": "Fragment",
166+
"name": "AddTodoMutation",
167+
"type": "Mutation",
168+
"metadata": null,
169+
"argumentDefinitions": (v0/*: any*/),
170+
"selections": (v2/*: any*/)
171+
},
172+
"operation": {
173+
"kind": "Operation",
174+
"name": "AddTodoMutation",
175+
"argumentDefinitions": (v0/*: any*/),
176+
"selections": (v2/*: any*/)
177+
},
178+
"params": {
179+
"operationKind": "mutation",
180+
"name": "AddTodoMutation",
181+
"id": null,
182+
"text": "mutation AddTodoMutation(\n $input: AddTodoInput!\n) {\n addTodo(input: $input) {\n todoEdge {\n __typename\n cursor\n node {\n complete\n id\n text\n }\n }\n viewer {\n id\n totalCount\n }\n }\n}\n",
183+
"metadata": {}
184+
}
185+
};
186+
})();
187+
(node as any).hash = 'd83bc4fc4eabb0be2a540834905e9427';
188+
export default node;

0 commit comments

Comments
 (0)