From b9baf4a9902ddd2dd09dd65e00699088fcbac403 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Fri, 3 Nov 2023 05:53:53 +0900 Subject: [PATCH] feat(hello): infer type correctly using `satisfies` (#228) * feat(hello): infer type correctly using `satisfies` * changeset --- .changeset/cold-comics-wonder.md | 5 +++++ packages/hello/package.json | 4 ++-- packages/hello/src/index.ts | 6 +++--- yarn.lock | 5 ----- 4 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 .changeset/cold-comics-wonder.md diff --git a/.changeset/cold-comics-wonder.md b/.changeset/cold-comics-wonder.md new file mode 100644 index 00000000..d7483aaa --- /dev/null +++ b/.changeset/cold-comics-wonder.md @@ -0,0 +1,5 @@ +--- +'@hono/hello': minor +--- + +feat: bump infer type correctly using `satisfies` diff --git a/packages/hello/package.json b/packages/hello/package.json index bad23964..261a8d85 100644 --- a/packages/hello/package.json +++ b/packages/hello/package.json @@ -28,6 +28,6 @@ "hono": "*" }, "devDependencies": { - "hono": "^2.7.2" + "hono": "^3.9.1" } -} \ No newline at end of file +} diff --git a/packages/hello/src/index.ts b/packages/hello/src/index.ts index 439846de..7eb92207 100644 --- a/packages/hello/src/index.ts +++ b/packages/hello/src/index.ts @@ -1,8 +1,8 @@ import type { MiddlewareHandler } from 'hono' -export const hello = (message: string = 'Hello!'): MiddlewareHandler => { - return async (c, next) => { +export const hello = (message: string = 'Hello!') => { + return (async (c, next) => { await next() c.res.headers.append('X-Message', message) - } + }) satisfies MiddlewareHandler } diff --git a/yarn.lock b/yarn.lock index 9a0fe6cd..21a06595 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5919,11 +5919,6 @@ heap-js@^2.2.0: resolved "https://registry.yarnpkg.com/heap-js/-/heap-js-2.3.0.tgz#8eed2cede31ec312aa696eef1d4df0565841f183" integrity sha512-E5303mzwQ+4j/n2J0rDvEPBN7GKjhis10oHiYOgjxsmxYgqG++hz9NyLLOXttzH8as/DyiBHYpUrJTZWYaMo8Q== -hono@^2.7.2: - version "2.7.8" - resolved "https://registry.yarnpkg.com/hono/-/hono-2.7.8.tgz#5f6916c7f6838fe1f909f6046b30e6a0900f3128" - integrity sha512-LXLXw6LilE16QO0siFBDiNzmaRP6ca5ZyF0gDWcaiUqJJtE/d4lV/Hpst2O33AmJB5n0DQa5w53gZLUVf7uXNg== - hono@^3.0.0, hono@^3.0.3, hono@^3.1.0, hono@^3.1.2, hono@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/hono/-/hono-3.2.6.tgz#b4927ed20b2edf165277f3e2b787a4e4948223f6"