@@ -755,11 +755,16 @@ type MongoQuerySelector<T extends MongoValue> = Partial<
755755
756756type MongoQuery < T extends MongoObject > = { [ K in keyof T ] ?: T [ K ] | MongoQuerySelector < T [ K ] > } & { _id ?: MongoId }
757757
758- type MongoUpdateOperators < T extends MongoObject > = Partial < {
758+ type MongoUpdateArrayOperatorUniversalModifiers < T > = { $each ?: T extends [ ] ? T : T [ ] }
759+
760+ type MongoUpdateArrayOperatorModifiers < T > = MongoUpdateArrayOperatorUniversalModifiers < T > &
761+ { $position ?: number , $slice ?: number , $sort ?: 1 | - 1 }
762+
763+ type MongoUpdateCommand < T extends MongoObject > = Partial < {
759764 /* Universal operators */
760- $set : Partial < Record < string , MongoCommandValue > & T >
761- $setOnInsert : Partial < Record < string , MongoCommandValue > & T >
762- $unset : Partial < Record < string , "" > & T >
765+ $set : Partial < Record < ( string & { } ) | keyof T , MongoCommandValue > >
766+ $setOnInsert : Partial < Record < ( string & { } ) | keyof T , MongoCommandValue > >
767+ $unset : Partial < Record < ( string & { } ) | keyof T , "" > >
763768
764769 $rename : Partial < Record < string , string > & { [ key in keyof T ] : string } >
765770
@@ -792,13 +797,6 @@ type MongoUpdateOperators<T extends MongoObject> = Partial<{
792797 $pullAll : Record < string , MongoCommandValue > & { [ K in keyof T as T [ K ] extends [ ] ? K : never ] ?: T [ K ] }
793798} >
794799
795- type MongoUpdateArrayOperatorUniversalModifiers < T > = { $each ?: T extends [ ] ? T : T [ ] }
796-
797- type MongoUpdateArrayOperatorModifiers < T > = MongoUpdateArrayOperatorUniversalModifiers < T > &
798- { $position ?: number , $slice ?: number , $sort ?: 1 | - 1 }
799-
800- type MongoUpdateCommand < Schema extends MongoObject > = MongoUpdateOperators < Schema >
801-
802800type SortOrder = { [ key : string ] : 1 | - 1 | SortOrder }
803801
804802type Cursor < T > = {
0 commit comments