Libraries
    Preparing search index...
    • Returns a new contract containing only the specified groups.

      The TypeScript return type is Pick<T, K> — the compiler sees exactly the selected groups and no others. This provides full type safety on the narrowed contract when passed to createClient() or used as a server handler map.

      Type Parameters

      • T extends ApiContract

        The shape of the source contract.

      • K extends string | number | symbol

        The union of group keys to keep.

      Parameters

      • contract: T

        The contract to select from.

      • ...groups: K[]

        The group keys to include.

      Returns Readonly<Pick<T, K>>

      A new frozen contract with only the listed groups.

      const fullApi = defineApi({ todos: {...}, auth: {...}, admin: {...}, debug: {...} });

      // Pick only the groups the frontend needs
      const clientApi = pickGroups(fullApi, 'todos', 'auth');
      // TypeScript: { todos: ..., auth: ... }