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

4.4.12 breaks client typing when using use with a path #3122

Closed
BryanAbate opened this issue Jul 10, 2024 · 7 comments · Fixed by #3128
Closed

4.4.12 breaks client typing when using use with a path #3122

BryanAbate opened this issue Jul 10, 2024 · 7 comments · Fixed by #3128
Labels

Comments

@BryanAbate
Copy link

What version of Hono are you using?

4.4.12

What runtime/platform is your app running on?

Node

What steps can reproduce the bug?

Stackblitz of the reproduction: https://stackblitz.com/edit/hono-client-typing-issue-middleware?file=src%2Fapp.ts

When using .use with a path like .use('*', myMiddleware) hono client typings will break. Removing the path '*' solves the typing issue.

I suppose #3087 introduced the regression.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@EdamAme-x
Copy link
Contributor

.use always generate { [x: string]: never }
image

@EdamAme-x
Copy link
Contributor

@EdamAme-x
Copy link
Contributor

generics of .use was marked at any
image

@EdamAme-x
Copy link
Contributor

EdamAme-x commented Jul 10, 2024

createMiddleware breaks typing
image

@EdamAme-x
Copy link
Contributor

I will try to work on this issue.
https://github.com/honojs/hono/blob/main/src/types.ts#L680

@EdamAme-x
Copy link
Contributor

EdamAme-x commented Jul 10, 2024

This is a common workaround, but I don't think it is what you are looking for.
image

@BryanAbate
Copy link
Author

Thank you for looking into the issue @EdamAme-x !

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