hono icon indicating copy to clipboard operation
hono copied to clipboard

RPC client: Type instantiation is excessively deep and possibly infinite

Open subhendupsingh opened this issue 2 years ago • 1 comments

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?

image

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?

  1. RPC client's type should be known beforehand so that I can declare it in a global app.d.ts file and pass it int the request.locals to get access in the entire app.
  2. RPC client should not slow down the intellisense

What do you see instead?

No response

Additional information

No response

subhendupsingh avatar Jan 08 '24 16:01 subhendupsingh

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!

yusukebe avatar Jan 09 '24 11:01 yusukebe