@micro-router
    Preparing search index...
    • Creates a new Path that maps the params of the given path to an object with a single key.

      This is useful for assigning a name to a path parameter, so that the matched value is returned as an object with the specified key, rather than as a raw value.

      For example, keyAs("id", parseNumber) will produce a Path that matches a number and returns { id: number } as params.

      Type Parameters

      • K extends string
      • P extends Path<string, any>

      Parameters

      • key: K

        The name to assign to the matched parameter.

      • path: P

        The Path whose params will be wrapped under the given key.

      Returns Path<
          `:${K}${WrapTypeIndicator<ReadableRepresentationOfPath<P>>}`,
          { [key in string]: DataOfPath<P> },
      >

      A new Path with params as an object keyed by key.