middleware icon indicating copy to clipboard operation
middleware copied to clipboard

app.use("/", cors()) throws TypeError

Open AstralBaby opened this issue 1 year ago • 1 comments

Using deno, latest version of hono as well as with latest version of middleware, just copied the example from the page https://hono.dev/middleware/builtin/cors and throws the next error No overload matches this call. Overload 1 of 12, '(...handlers: MiddlewareHandler<Env, never, {}>[]): Hono<{}, BlankSchema, "/">', gave the following error. Argument of type 'string' is not assignable to parameter of type 'MiddlewareHandler<Env, never, {}>'. Overload 2 of 12, '(handlers_0: MiddlewareHandler<Env, never, {}>, handlers_1: MiddlewareHandler<{}, never, {}>): Hono<{}, BlankSchema, "/">', gave the following error. Argument of type 'string' is not assignable to parameter of type 'MiddlewareHandler<Env, never, {}>'. Overload 3 of 12, '(path: "/", ...handlers: MiddlewareHandler<Env, "/", {}>[]): Hono<Env, BlankSchema, "/">', gave the following error. Argument of type 'MiddlewareHandler' is not assignable to parameter of type 'MiddlewareHandler<Env, "/", {}>'. Types of parameters 'c' and 'c' are incompatible. Type 'Context<Env, "/", {}>' is not assignable to type 'Context<any, string, {}>'. Property '#status' in type 'Context' refers to a different member that cannot be accessed from within type 'Context'.deno-ts(2769)

AstralBaby avatar Apr 05 '24 23:04 AstralBaby

Hi @AstralBaby

Try:

 deno cache --reload main.t

yusukebe avatar Apr 06 '24 11:04 yusukebe