Middleware that will call handler whenever method RPC method is called.
This helper exists due to TypeScript limitations not allowing us to
properly type the return type without explicit type annotations,
for a bit more type-safe and clean code:
// after onMethod('help.getNearestDc', async () => ({ _:'nearestDc'asconst, // (otherwise ts will infer this as `string` and will complain) country:'RU', thisDc:2, nearestDc:2, })
Middleware that will call
handlerwhenevermethodRPC method is called.This helper exists due to TypeScript limitations not allowing us to properly type the return type without explicit type annotations, for a bit more type-safe and clean code: