effect-rpc
    Preparing search index...

    Function createRpcGroupRegistry

    • Creates a type-safe handler registry that maintains exact type relationships.

      This is the recommended way to achieve full type safety. The registry uses a builder pattern to accumulate groups and maintain their types without any global state.

      You can use it to manage all requests and handlers in a type-safe manner, and access the requests directly without needing to know all request names or the router.

      Type Parameters

      • T extends Record<string, RpcGroup<any>> = {}

      Returns RpcGroupRegistry<T>

      A registry object with methods to register and retrieve groups with full type safety

      // Create a registry and register groups
      const registry = createRpcGroupRegistry()
      .register('flamingo', helloRouter)
      .register('users', userRouter);

      // Get groups with full type safety
      const flamingoGroup = registry.get('flamingo');
      const validRequest = flamingoGroup.getRequest('SayHelloReq'); // ✓ Type-safe!
      // const invalid = flamingoGroup.getRequest('IDontExist'); // ✗ Type error!

      0.8.0