Commit 9533fe0
committed
TypeScript template feature: generate full schema type
This adds a new `schemaType` option to the TypeScript template. When used, this option will add a type to the generated TypeScript code that represents the entirety of the input GraphQL schema's type system. Each type from the schema will be placed as a property on the interface and given its declared type.
The new interface is named `Schema`, optionally prefixed by the `interfacePrefix` option and placed within the optional `schemaNamespace` namespace.
This type is not generated by default. It is useful when the context of the schema as a whole is needed, such as when determining whether a GraphQL type name used in code is properly referencing a type that exists in a target GraphQL schema.1 parent 8e20bfd commit 9533fe0
4 files changed
Lines changed: 19 additions & 1 deletion
File tree
- packages/templates/typescript
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
66 | 77 | | |
67 | 78 | | |
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
71 | | - | |
| 82 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments