import { serve } from "@hono/node-server";
import { HonoDiskStorage } from "@hono-storage/node-disk";
import { Hono } from "hono";
const app = new Hono();
const storage = new HonoDiskStorage({
dest: "./uploads",
filename: (_, file) => `${file.originalname}-${Date.now()}.${file.extension}`,
});
app.post("/", storage.single("file"), (c) => c.text("OK"));
serve(app);
Error message over storage.single()
No overload matches this call.
The last overload gave the following error.
Argument of type 'MiddlewareHandler<{ Variables: { files: { file?: FieldValue | undefined; }; }; }>' is not assignable to parameter of type 'H<Env, "/", BlankInput, HandlerResponse<any>>'.
Type 'MiddlewareHandler<{ Variables: { files: { file?: FieldValue | undefined; }; }; }>' is not assignable to type 'MiddlewareHandler<Env, "/", BlankInput>'.
Types of parameters 'c' and 'c' are incompatible.
Type 'Context<Env, "/", BlankInput>' is not assignable to type 'Context<{ Variables: { files: { file?: FieldValue | undefined; }; }; }, string, {}>'.
Property '#private' in type 'Context' refers to a different member that cannot be accessed from within type 'Context'.ts(2769)
types.d.ts(154, 5): The last overload is declared here.
It seems that there is a type discrepancy when using Hono 4 series Hono because they have not updated the Hono version.
I’ll patch it the next version, Thank you.
Using the following dependencies:
index.ts
Error message over
storage.single()
You got an idea, what's wrong?