How to define RPC methods on a separate file

I have an RPC method that is very long and thus don't want to define in the same place as other functions. I though about doing myFunction = myFunction but it complains that The RPC receiver does not implement the method "myFunction". Since myFunction uses this it's defined as:
export async function myFunction(
this: AuthWorker,
otherArg: SomeOtherType,
) {}
export async function myFunction(
this: AuthWorker,
otherArg: SomeOtherType,
) {}
I even tried "proxying" it
import { myFunction } from './some/other/path'
async myFunction(...args: Parameters<typeof myFunction>) {
return await myFunction(this, ...args);
}
import { myFunction } from './some/other/path'
async myFunction(...args: Parameters<typeof myFunction>) {
return await myFunction(this, ...args);
}
but now it complains that it expected 1 arg, but got two
1 Reply
veeque
veequeOP3d ago
posting always helps. found solution
return await createUser.apply(this, args);
return await createUser.apply(this, args);

Did you find this page helpful?