Interface return type in RPC functions for Service / WorkerEntrypoint
I'm trying to implement a RPC Service in my auth service worker that verifies a jwt token, but whenever import an interface type from another file, it infers the return type of the RPC to never. But when I turn that interface into a type instead of interface, it does work, why is that?
2 Replies
I can cast the interface to a format that does work for type inference in the RPC calls:
Thanks for this! I am experiencing the same thing and I never would have thought to try type vs interface.
I also have a situation where the return type shows
undefined
for a similar reason. If I use an interface
to define the shape, or an unknown
for a RHS then it'll break. If I use type
s and any
then works as expected
but UGH!