You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/data-schema/src/runtime/client/index.ts
+40-9Lines changed: 40 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -84,21 +84,52 @@ type ReturnValue<
84
84
* This mapped type traverses the SelectionSetReturnValue result and the original FlatModel, restoring array types
85
85
* that were flattened in DeepPickFromPath
86
86
*
87
-
* Note: custom type field arrays are already handled correctly and don't need to be "restored", hence the `Result[K] extends Array<any>` check
87
+
* @typeParam Result - this is the result of applying the selection set path to FlatModel; return type of UnionToIntersection<DeepPickFromPath<FlatModel, Paths>>
88
+
* @typeParam FlatModel - the reference model shape; return type of ResolvedModel<Model>
88
89
*
90
+
* Note: we wrap `Result` and `FlatModel` in NonNullable, because recursive invocations of this mapped type
91
+
* can result in the type arguments containing `{} | null | undefined` which breaks indexed access, e.g. Result[K]
92
+
*
93
+
* Using NonNullable<> directly inside the mapped type is significantly more performant here than attempting to pre-compute in the type params,
0 commit comments