SelectionResult type

Computes the entity shape returned by a GraphQL field selection.

Scalar fields become a top-level Pick, while relationship paths produce nested objects or arrays containing only the requested relationship fields.

type SelectionResult<T, TFields> = TFields extends readonly Object
  ? GraphQLResponseValue<PrimaryKeyOnly<T>>
  : number extends TFields["length"]
  ? UncertainSelectionResult<T, TFields>
  : [UncertainSelectionFields<TFields>] extends [never]
  ? ExactSelectionResult<T, TFields>
  : PartiallyCertainSelectionResult<T, TFields>