honojs / hono

Web framework built on Web Standards
https://hono.dev
MIT License
18.48k stars 520 forks source link

Hono does not seem to work correctly with Vue #3212

Closed buzzy closed 1 week ago

buzzy commented 1 month ago

What version of Hono are you using?

4.5.3

What runtime/platform is your app running on?

Bun

What steps can reproduce the bug?

Pull this repo: https://github.com/buzzy/hono-vue

Look in the file /src/api/server.ts It's a very simple example that uses hono and zod-validator image

Look in the file /src/api/client.ts image

As you can see in the picture, all the types get imported correctly.

Now open file /src/views/HomeView.vue This is a Vue component file. image

Using the exact same imports as in the server.ts, all types are working except for the input type. It's blank.

What is the expected behavior?

That all the types are imported, including the "input" attribute.

What do you see instead?

When using Hono RPC in a Vue component, the "input" is always blank.

Additional information

No response

yusukebe commented 1 month ago

Hi @buzzy

Add a strict: true in your tsconfig.json:

diff --git a/tsconfig.json b/tsconfig.json
index 66b5e57..5c6a83b 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,5 +1,8 @@
 {
   "files": [],
+  "compilerOptions": {
+    "strict": true
+  },
   "references": [
     {
       "path": "./tsconfig.node.json"
@@ -8,4 +11,4 @@
       "path": "./tsconfig.app.json"
     }
   ]
-}
+}
yusukebe commented 1 week ago

I'll close this issue. If you need any help related to Hono, please reopen. Anyway, this issue is caused by TypeScript settings.