@@ -292,14 +292,14 @@ export class Query<M extends Model = Model> {
292292 /**
293293 * Add a "where has" clause to the query.
294294 */
295- whereHas < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } , operator ?: string | number , count ?: number ) : this {
295+ whereHas < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null | undefined ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } , operator ?: string | number , count ?: number ) : this {
296296 return this . where ( this . getFieldWhereForRelations ( relation , callback , operator , count ) )
297297 }
298298
299299 /**
300300 * Add an "or where has" clause to the query.
301301 */
302- orWhereHas < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } , operator ?: string | number , count ?: number ) : this {
302+ orWhereHas < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null | undefined ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } , operator ?: string | number , count ?: number ) : this {
303303 return this . orWhere ( this . getFieldWhereForRelations ( relation , callback , operator , count ) )
304304 }
305305
@@ -334,14 +334,14 @@ export class Query<M extends Model = Model> {
334334 /**
335335 * Add a "where doesn't have" clause to the query.
336336 */
337- whereDoesntHave < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } ) : this {
337+ whereDoesntHave < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null | undefined ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } ) : this {
338338 return this . where ( this . getFieldWhereForRelations ( relation , callback , '=' , 0 ) )
339339 }
340340
341341 /**
342342 * Add an "or where doesn't have" clause to the query.
343343 */
344- orWhereDoesntHave < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } ) : this {
344+ orWhereDoesntHave < T extends WithKeys < M > > ( relation : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null | undefined ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } ) : this {
345345 return this . orWhere ( this . getFieldWhereForRelations ( relation , callback , '=' , 0 ) )
346346 }
347347
@@ -386,7 +386,7 @@ export class Query<M extends Model = Model> {
386386 /**
387387 * Set the relationships that should be eager loaded.
388388 */
389- with < T extends WithKeys < M > > ( name : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } ) : this {
389+ with < T extends WithKeys < M > > ( name : T | string & { } , callback : M [ T ] extends Model | Model [ ] | null | undefined ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } ) : this {
390390 this . getNewHydrated = true
391391 // @ts -expect-error name type can be used
392392 this . eagerLoad [ name ] = callback
@@ -434,7 +434,7 @@ export class Query<M extends Model = Model> {
434434 /**
435435 * Get where closure for relations
436436 */
437- protected getFieldWhereForRelations < T extends WithKeys < M > > ( relation : T | ( string & { } ) , callback : M [ T ] extends Model | Model [ ] | null ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } , operator ?: string | number , count ?: number ) : WherePrimaryClosure < M > {
437+ protected getFieldWhereForRelations < T extends WithKeys < M > > ( relation : T | ( string & { } ) , callback : M [ T ] extends Model | Model [ ] | null | undefined ? EagerLoadConstraint < GetElementType < NonNullable < M [ T ] > > > : ( ) => void = ( ) => { } , operator ?: string | number , count ?: number ) : WherePrimaryClosure < M > {
438438 const modelIdsByRelation = this . newQuery ( this . model . $entity ( ) ) . with ( relation , callback ) . get ( false )
439439 . filter ( ( model ) => {
440440 const modelRelation = model [ relation as T ]
0 commit comments