@@ -25,16 +25,20 @@ The difference is that is uses generic types, so that you have type safety with
25
25
<!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/codegenTypedDocuments.yml) -->
26
26
<!-- The below code snippet is automatically added from ./examples/docs/codegenTypedDocuments.yml -->
27
27
``` yml
28
- schema : ./ schema.graphql
29
- documents : ./documents /*.graphql
28
+ schema : schema.graphql
29
+ documents : src/** /*.graphql
30
30
generates :
31
- ./codegenTypedDocuments.d.ts :
31
+ ./src/ codegenTypedDocuments.d.ts :
32
32
plugins :
33
33
- apollo-typed-documents/lib/codegenTypedDocuments
34
34
config :
35
35
typesModule : " @codegen-types"
36
- ./codegenTypes.ts :
36
+ ./src/ codegenTypes.d .ts :
37
37
plugins :
38
+ - add : ' declare module "@codegen-types" {'
39
+ - add :
40
+ placement : append
41
+ content : " }"
38
42
- typescript
39
43
- typescript-operations
40
44
` ` `
@@ -67,10 +71,10 @@ the configuration needs to have more options set: [reference](examples/docs/tsco
67
71
68
72
# ## Example
69
73
70
- `./documents /authors.graphql` :
74
+ `src /authors.graphql` :
71
75
72
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/documents /authors.graphql) -->
73
- <!-- The below code snippet is automatically added from ./examples/docs/documents /authors.graphql -->
76
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/src /authors.graphql) -->
77
+ <!-- The below code snippet is automatically added from ./examples/docs/src /authors.graphql -->
74
78
` ` ` graphql
75
79
query authors {
76
80
authors {
@@ -86,10 +90,10 @@ query authors {
86
90
` ` `
87
91
<!-- AUTO-GENERATED-CONTENT:END -->
88
92
89
- `./documents /createAuthor.graphql` :
93
+ `src /createAuthor.graphql` :
90
94
91
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/documents /createAuthor.graphql) -->
92
- <!-- The below code snippet is automatically added from ./examples/docs/documents /createAuthor.graphql -->
95
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/src /createAuthor.graphql) -->
96
+ <!-- The below code snippet is automatically added from ./examples/docs/src /createAuthor.graphql -->
93
97
` ` ` graphql
94
98
mutation createAuthor($input: AuthorInput!) {
95
99
createAuthor(input: $input) {
@@ -105,10 +109,10 @@ mutation createAuthor($input: AuthorInput!) {
105
109
` ` `
106
110
<!-- AUTO-GENERATED-CONTENT:END -->
107
111
108
- `. /codegenTypedDocuments.d.ts` (generated) :
112
+ `src /codegenTypedDocuments.d.ts` (generated) :
109
113
110
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/codegenTypedDocuments.d.ts) -->
111
- <!-- The below code snippet is automatically added from ./examples/docs/codegenTypedDocuments.d.ts -->
114
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/src/ codegenTypedDocuments.d.ts) -->
115
+ <!-- The below code snippet is automatically added from ./examples/docs/src/ codegenTypedDocuments.d.ts -->
112
116
` ` ` ts
113
117
declare module "*/authors.graphql" {
114
118
import { TypedDocumentNode } from "apollo-typed-documents";
@@ -126,16 +130,16 @@ declare module "*/createAuthor.graphql" {
126
130
` ` `
127
131
<!-- AUTO-GENERATED-CONTENT:END -->
128
132
129
- `. /AuthorList.js` :
133
+ `src /AuthorList.js` :
130
134
131
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/AuthorList.js) -->
132
- <!-- The below code snippet is automatically added from ./examples/docs/AuthorList.js -->
135
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/src/ AuthorList.js) -->
136
+ <!-- The below code snippet is automatically added from ./examples/docs/src/ AuthorList.js -->
133
137
` ` ` js
134
138
import { useMutation, useQuery } from "@apollo/react-hooks";
135
139
import React from "react";
136
140
137
- import authorsQuery from "./documents/ authors.graphql";
138
- import createAuthorMutation from "./documents/ createAuthor.graphql";
141
+ import authorsQuery from "./authors.graphql";
142
+ import createAuthorMutation from "./createAuthor.graphql";
139
143
140
144
const AuthorList = () => {
141
145
// Type of ` data` is inferred (AuthorsQuery)
@@ -275,18 +279,18 @@ When used together with `codegenTypedDocuments` the data and variables are type
275
279
<!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/codegenApolloMock.yml) -->
276
280
<!-- The below code snippet is automatically added from ./examples/docs/codegenApolloMock.yml -->
277
281
``` yml
278
- schema : ./ schema.graphql
279
- documents : ./documents /*.graphql
282
+ schema : schema.graphql
283
+ documents : src/** /*.graphql
280
284
generates :
281
- ./apolloMock.js :
285
+ ./src/ apolloMock.js :
282
286
plugins :
283
287
- apollo-typed-documents/lib/codegenApolloMock
284
288
` ` `
285
289
<!-- AUTO-GENERATED-CONTENT:END -->
286
290
287
291
### Example
288
292
289
- ` ./ schema.graphql`:
293
+ ` schema.graphql`:
290
294
291
295
<!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/schema.graphql) -->
292
296
<!-- The below code snippet is automatically added from ./examples/docs/schema.graphql -->
@@ -328,10 +332,10 @@ schema {
328
332
` ` `
329
333
<!-- AUTO-GENERATED-CONTENT:END -->
330
334
331
- `./documents /authors.graphql` :
335
+ `src /authors.graphql` :
332
336
333
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/documents /authors.graphql) -->
334
- <!-- The below code snippet is automatically added from ./examples/docs/documents /authors.graphql -->
337
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/src /authors.graphql) -->
338
+ <!-- The below code snippet is automatically added from ./examples/docs/src /authors.graphql -->
335
339
` ` ` graphql
336
340
query authors {
337
341
authors {
@@ -347,10 +351,10 @@ query authors {
347
351
` ` `
348
352
<!-- AUTO-GENERATED-CONTENT:END -->
349
353
350
- `./documents /createAuthor.graphql` :
354
+ `src /createAuthor.graphql` :
351
355
352
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/documents /createAuthor.graphql) -->
353
- <!-- The below code snippet is automatically added from ./examples/docs/documents /createAuthor.graphql -->
356
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/src /createAuthor.graphql) -->
357
+ <!-- The below code snippet is automatically added from ./examples/docs/src /createAuthor.graphql -->
354
358
` ` ` graphql
355
359
mutation createAuthor($input: AuthorInput!) {
356
360
createAuthor(input: $input) {
@@ -366,18 +370,18 @@ mutation createAuthor($input: AuthorInput!) {
366
370
` ` `
367
371
<!-- AUTO-GENERATED-CONTENT:END -->
368
372
369
- `. /apolloMock.js` (generated) :
373
+ `src /apolloMock.js` (generated) :
370
374
371
- See : [reference](examples/docs/apolloMock.js)
375
+ See : [reference](examples/docs/src/ apolloMock.js)
372
376
373
- `. /apolloMock.test.js` :
377
+ `src /apolloMock.test.js` :
374
378
375
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/apolloMock.test.js) -->
376
- <!-- The below code snippet is automatically added from ./examples/docs/apolloMock.test.js -->
379
+ <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/docs/src/ apolloMock.test.js) -->
380
+ <!-- The below code snippet is automatically added from ./examples/docs/src/ apolloMock.test.js -->
377
381
` ` ` js
378
382
import apolloMock from "./apolloMock";
379
- import authors from "./documents/ authors.graphql";
380
- import createAuthor from "./documents/ createAuthor.graphql";
383
+ import authors from "./authors.graphql";
384
+ import createAuthor from "./createAuthor.graphql";
381
385
382
386
describe("apolloMock", () => {
383
387
it("produces the minimal output that is valid according to graphql schema", () => {
0 commit comments