diff --git a/.changeset/bumpy-birds-act.md b/.changeset/bumpy-birds-act.md new file mode 100644 index 00000000..887c14de --- /dev/null +++ b/.changeset/bumpy-birds-act.md @@ -0,0 +1,5 @@ +--- +'@hono/hello': patch +--- + +Add explicit `MiddlewareHandler` return type diff --git a/packages/hello/src/index.ts b/packages/hello/src/index.ts index ca5863bb..12c9b77f 100644 --- a/packages/hello/src/index.ts +++ b/packages/hello/src/index.ts @@ -1,6 +1,7 @@ +import type { MiddlewareHandler } from 'hono' import { createMiddleware } from 'hono/factory' -export const hello = (message: string = 'Hello!') => { +export const hello = (message: string = 'Hello!'): MiddlewareHandler => { return createMiddleware(async (c, next) => { await next() c.res.headers.append('X-Message', message) diff --git a/packages/hello/tsconfig.build.json b/packages/hello/tsconfig.build.json index ccc2f65a..a82a1266 100644 --- a/packages/hello/tsconfig.build.json +++ b/packages/hello/tsconfig.build.json @@ -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"],