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
@@ -112,9 +198,9 @@ export type IsValidResultOverride<Result, NewResult, ErrorResult, ErrorNewResult
112
198
true
113
199
: ErrorResult
114
200
: NewResultextendsany[]
115
-
? ErrorNewResult
116
-
: // Neither are arrays - valid
117
-
true
201
+
? ErrorNewResult
202
+
: // Neither are arrays - valid
203
+
true
118
204
/**
119
205
* Utility type to check if array types match between Result and NewResult.
120
206
* Returns either the valid NewResult type or an error message type.
@@ -124,23 +210,23 @@ export type CheckMatchingArrayTypes<Result, NewResult> =
124
210
ResultextendsSelectQueryError<string>
125
211
? NewResult
126
212
: IsValidResultOverride<
127
-
Result,
128
-
NewResult,
129
-
{
130
-
Error: 'Type mismatch: Cannot cast array result to a single object. Use .overrideTypes<Array<YourType>> or .returns<Array<YourType>> (deprecated) for array results or .single() to convert the result to a single object'
131
-
},
132
-
{
133
-
Error: 'Type mismatch: Cannot cast single object to array type. Remove Array wrapper from return type or make sure you are not using .single() up in the calling chain'
134
-
}
135
-
>extends infer ValidationResult
136
-
? ValidationResultextendstrue
137
-
? // Preserve the optionality of the result if the overriden type is an object (case of chaining with `maybeSingle`)
138
-
ContainsNull<Result>extendstrue
139
-
? NewResult|null
140
-
: NewResult
141
-
: // contains the error
142
-
ValidationResult
143
-
: never
213
+
Result,
214
+
NewResult,
215
+
{
216
+
Error: 'Type mismatch: Cannot cast array result to a single object. Use .overrideTypes<Array<YourType>> or .returns<Array<YourType>> (deprecated) for array results or .single() to convert the result to a single object'
217
+
},
218
+
{
219
+
Error: 'Type mismatch: Cannot cast single object to array type. Remove Array wrapper from return type or make sure you are not using .single() up in the calling chain'
220
+
}
221
+
>extends infer ValidationResult
222
+
? ValidationResultextendstrue
223
+
? // Preserve the optionality of the result if the overriden type is an object (case of chaining with `maybeSingle`)
224
+
ContainsNull<Result>extendstrue
225
+
? NewResult|null
226
+
: NewResult
227
+
: // contains the error
228
+
ValidationResult
229
+
: never
144
230
145
231
typeSimplify<T>=Textendsobject ? {[KinkeyofT]: T[K]} : T
146
232
@@ -157,25 +243,25 @@ type MergeExplicit<New, Row> = {
157
243
? Row[K]extendsSelectQueryError<string>
158
244
? New[K]
159
245
: // Check if the override is on a embedded relation (array)
0 commit comments