refactor(graphql-server): enable isolated declarations (#1197)

pull/1206/head
Jonathan Haines 2025-06-09 19:16:01 +10:00 committed by GitHub
parent 3a9920a258
commit ab390305fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/graphql-server': patch
---
Add explicit `Response` return type

View File

@ -216,7 +216,9 @@ export const getGraphQLParams = async (request: Request): Promise<GraphQLParams>
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(`<!--
* Copyright (c) 2021 GraphQL Contributors

View File

@ -4,7 +4,8 @@
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/tsconfig.build.tsbuildinfo",
"emitDeclarationOnly": false
"emitDeclarationOnly": false,
"isolatedDeclarations": true
},
"include": ["src/**/*.ts"],
"exclude": ["**/*.test.ts"],