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?
1 Reply
ItsWendell
ItsWendell2mo ago
I can cast the interface to a format that does work for type inference in the RPC calls:
export type ToType<T> = {
[K in keyof T]: T[K];
};
export type ToType<T> = {
[K in keyof T]: T[K];
};