From ab390305fba1d9bd99da46537f28763f7d5df8df Mon Sep 17 00:00:00 2001 From: Jonathan Haines Date: Mon, 9 Jun 2025 19:16:01 +1000 Subject: [PATCH] refactor(graphql-server): enable isolated declarations (#1197) --- .changeset/huge-clocks-behave.md | 5 +++++ packages/graphql-server/src/index.ts | 6 ++++-- packages/graphql-server/tsconfig.build.json | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .changeset/huge-clocks-behave.md diff --git a/.changeset/huge-clocks-behave.md b/.changeset/huge-clocks-behave.md new file mode 100644 index 00000000..f203f6a6 --- /dev/null +++ b/.changeset/huge-clocks-behave.md @@ -0,0 +1,5 @@ +--- +'@hono/graphql-server': patch +--- + +Add explicit `Response` return type diff --git a/packages/graphql-server/src/index.ts b/packages/graphql-server/src/index.ts index b91911c8..3e14dd7c 100644 --- a/packages/graphql-server/src/index.ts +++ b/packages/graphql-server/src/index.ts @@ -216,7 +216,9 @@ export const getGraphQLParams = async (request: Request): Promise export const errorMessages = ( messages: string[], graphqlErrors?: readonly GraphQLError[] | readonly GraphQLFormattedError[] -) => { +): { + errors: readonly GraphQLError[] | readonly GraphQLFormattedError[] +} => { if (graphqlErrors) { return { errors: graphqlErrors, @@ -232,7 +234,7 @@ export const errorMessages = ( } } -export const respondWithGraphiQL = (c: Context) => { +export const respondWithGraphiQL = (c: Context): Response => { // https://github.com/graphql/graphiql/blob/03171d5614c61fb345763636d120da2b536d54a0/examples/graphiql-cdn/index.html return c.html(`