H
Hono3mo ago
Joker

RPC can't get types

import { hc } from 'hono/client';
import type { AppType } from './index.js';

const c = hc<AppType>('http://localhost:3000');
import { hc } from 'hono/client';
import type { AppType } from './index.js';

const c = hc<AppType>('http://localhost:3000');
import { Hono } from 'hono';
//import { prettyJSON } from 'hono/pretty-json';

const app = new Hono();

app.get('/health', (c) => {
return c.json({ status: 'ok' });
});

export type AppType = typeof app;

//app.use(prettyJSON());
//app.use(logger());

export default app;
import { Hono } from 'hono';
//import { prettyJSON } from 'hono/pretty-json';

const app = new Hono();

app.get('/health', (c) => {
return c.json({ status: 'ok' });
});

export type AppType = typeof app;

//app.use(prettyJSON());
//app.use(logger());

export default app;
No description
1 Reply
blair
blair3mo ago
You need to chain your methods for the RPC to work, but firstly, is the type import resolving correctly?

Did you find this page helpful?