Skip to content

Commit c156742

Browse files
Docs: Fix generate-types syntax (#7832)
This change fixes the typescript error in the example of splitting resolvers in multiple files. The `books` and `addBooks` must no be wrapped with a `Queries` or `Mutation` object. Wrong (screenshot taken from the official docs) ![image](https://github.com/apollographql/apollo-server/assets/17274950/8b002200-0c72-4556-b696-3b5956cc730a) Correct without `Queries` parent key (extracted from the working exampled linked at the end of the markdown file) ![image](https://github.com/apollographql/apollo-server/assets/17274950/6e9d167f-9215-4baf-8821-ceda407680e4)
1 parent 26c6b2c commit c156742

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

docs/source/workflow/generate-types.mdx

+1-5
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ import { QueryResolvers } from '__generated__/resolvers-types';
163163
// Use the generated `QueryResolvers`
164164
// type to type check our queries!
165165
const queries: QueryResolvers = {
166-
Query: {
167166
// ...queries
168-
},
169167
};
170168

171169
export default queries;
@@ -177,9 +175,7 @@ import { MutationResolvers } from '__generated__/resolvers-types';
177175
// Use the generated `MutationResolvers` type
178176
// to type check our mutations!
179177
const mutations: MutationResolvers = {
180-
Mutation: {
181-
// ...mutations
182-
},
178+
// ...mutations
183179
};
184180

185181
export default mutations;

0 commit comments

Comments
 (0)