this is the result of applying the selection set path to FlatModel; return type of UnionToIntersection<DeepPickFromPath<FlatModel, Paths>>
the reference model shape; return type of ResolvedModel
Note: we wrap Result and FlatModel in NonNullable, because recursive invocations of this mapped type
can result in the type arguments containing {} | null | undefined which breaks indexed access, e.g. Result[K]
Using NonNullable<> directly inside the mapped type is significantly more performant here than attempting to pre-compute in the type params,
e.g., type RestoreArrays<Result, FlatModel, NonNullableResult = NonNullable<Result>, NonNullableFlatModel = NonNullable<FlatModel>> = {...}
This mapped type traverses the SelectionSetReturnValue result and the original FlatModel, restoring array types that were flattened in DeepPickFromPath