Creates a type-safe registry of tagged requests for RPC communication. Returns a registry object with a makeRequest method that provides full type safety.
The tag to identify the requests.
An object mapping request names to request constructors.
A type-safe registry with a makeRequest method.
const helloRequests = createRequests("@/hello/SayHelloRequests", { SayHelloReq, SayByeReq,});// Fully type-safe - TypeScript knows this returns SayHelloReqconst request = helloRequests.makeRequest("SayHelloReq"); Copy
const helloRequests = createRequests("@/hello/SayHelloRequests", { SayHelloReq, SayByeReq,});// Fully type-safe - TypeScript knows this returns SayHelloReqconst request = helloRequests.makeRequest("SayHelloReq");
Error if a request with the same tag already exists.
0.7.0
Creates a type-safe registry of tagged requests for RPC communication. Returns a registry object with a makeRequest method that provides full type safety.