hono
hono copied to clipboard
RPC client: Type instantiation is excessively deep and possibly infinite
What version of Hono are you using?
3.11.11
What runtime/platform is your app running on?
Cloudflare Workers
What steps can reproduce the bug?
I initialize hono client in my SvelteKit app like this
let tclient: ReturnType<typeof getClient> | null = null;
Where getClient method is:
export const getClient = (headers: Headers, cookies: Cookies) =>{
const client = hc<AppType>('http://127.0.0.1:8976',{
headers: clientHeaders
});
return client;
}
Also, once I call the getClient method anywhere in my application, the intellisense becomes extremely slow, but works fine.
What is the expected behavior?
- RPC client's type should be known beforehand so that I can declare it in a global
app.d.tsfile and pass it int therequest.localsto get access in the entire app. - RPC client should not slow down the intellisense
What do you see instead?
No response
Additional information
No response
Hi @subhendupsingh
I cannot reproduce that behavior in my environment. If it is possible, I would like you to create a project to reproduce it and share it with us. Thanks!