Skip to content

Commit 8c51a0e

Browse files
authored
docs(vanilla typescript): Fix the return type of the exec function
When working through the vanilla typescript example I found that the shape of the data actually returned by the fetch was `result.data.
1 parent a4acc9e commit 8c51a0e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

website/src/pages/docs/guides/vanilla-typescript.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ We can build a simple wrapper around `fetch` that takes a `TypedDocumentString`
181181
returns a typed response.
182182

183183
```typescript filename="src/graphql/execute.ts"
184+
import { ExecutionResult } from "graphql";
184185
import type { TypedDocumentString } from './graphql'
185186

186187
export async function execute<TResult, TVariables>(
@@ -203,7 +204,7 @@ export async function execute<TResult, TVariables>(
203204
throw new Error('Network response was not ok')
204205
}
205206

206-
return response.json() as TResult
207+
return response.json() as ExecutionResult<TResult>
207208
}
208209
```
209210

0 commit comments

Comments
 (0)