Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AstralBaby opened this issue Apr 5, 2024 · 1 comment
Open

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

AstralBaby opened this issue Apr 5, 2024 · 1 comment

Comments

@AstralBaby
Copy link

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)

@yusukebe
Copy link
Member

yusukebe commented Apr 6, 2024

Hi @AstralBaby

Try:

 deno cache --reload main.t

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants