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

Types of typiaValidator in typia-validator are not compatible with hono 4.x #944

Open
jirutka opened this issue Jan 22, 2025 · 1 comment
Labels

Comments

@jirutka
Copy link

jirutka commented Jan 22, 2025

Which middleware has the bug?

@hono/typia-validator

What version of the middleware?

0.1.0

What version of Hono are you using?

4.6.17

What runtime/platform is your app running on? (with version if possible)

Node.js

What steps can reproduce the bug?

I noticed two problems:

  1. typia.http.createValidateQuery doesn’t work, it throws TypeError: xxx.get is not a function (in the most basic case, so reproduction is trivial). (My fault, I imported typiaValidator from @hono/typia-validator instead of @hono/typia-validator/http.)

  2. There’s a type error in packages/typia-validator/src/index.ts:32-51:

Type 'MiddlewareHandler<E, P, { in: { [K in Target]: K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }; }; out: { [K_1 in Target]: any; }; }>' is not assignable to type 'MiddlewareHandler<E, P, V>'.
  Types of parameters 'c' and 'c' are incompatible.
    Type 'Context<E, P, V>' is not assignable to type 'Context<E, P, { in: { [K in Target]: K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }; }; out: { [K_1 in Target]: any; }; }>'.
      Type 'V' is not assignable to type '{ in: { [K in Target]: K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }; }; out: { [K_1 in Target]: any; }; }'.
        Type '{ in: { [K in Target]: O; }; out: { [K in Target]: O; }; }' is not assignable to type '{ in: { [K in Target]: K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }; }; out: { [K_1 in Target]: any; }; }'.
          Types of property 'in' are incompatible.
            Type '{ [K in Target]: O; }' is not assignable to type '{ [K in Target]: K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }; }'.
              Type 'O' is not assignable to type 'K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }'.
                Type 'OutputType<T>' is not assignable to type 'K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }'.
                  Type 'unknown' is not assignable to type 'K extends "json" ? unknown : { [x: string]: ValidationTargets[K][string]; }'.ts(2322)

And I cannot figure out how to fix it, this type is incredibly complex.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@jirutka jirutka added the triage label Jan 22, 2025
@jirutka jirutka changed the title typia-validator is not compatible with hono 4.x Types of typiaValidator in typia-validator are not compatible with hono 4.x Jan 22, 2025
@yusukebe
Copy link
Member

@jirutka Thank you for raising the issue.

Hi @dworznik, can you handle this?

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

No branches or pull requests

2 participants