docs(graphql-server): update example code to Typescript and parameter name (#640)

* fix(graphql-server): update parameter name in `RootResolver` type from `ctx` to `c`

* docs(graphql-server): update README to use TypeScript in example code
pull/644/head
3w36zj6 2024-07-15 17:38:06 +09:00 committed by GitHub
parent e6afa4bd3d
commit cc1e8a4911
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -16,11 +16,11 @@ yarn add @hono/graphql-server
## Usage
index.js:
index.ts:
```js
```ts
import { Hono } from 'hono'
import { graphqlServer } from '@hono/graphql-server'
import { type RootResolver, graphqlServer } from '@hono/graphql-server'
import { buildSchema } from 'graphql'
export const app = new Hono()
@ -31,7 +31,7 @@ type Query {
}
`)
const rootResolver = (ctx) => {
const rootResolver: RootResolver = (c) => {
return {
hello: () => 'Hello Hono!',
}

View File

@ -23,7 +23,7 @@ import { parseBody } from './parse-body'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type RootResolver<E extends Env = any, P extends string = any, I extends Input = {}> = (
// eslint-enable-next-line @typescript-eslint/no-explicit-any
ctx?: Context<E, P, I>
c?: Context<E, P, I>
) => Promise<unknown> | unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any