@@ -712,47 +712,53 @@ declare module 'mongoose' {
712
712
[ K in keyof T ] : FlattenProperty < T [ K ] > ;
713
713
} ;
714
714
715
- export type BufferToBinaryProperty < T > = T extends Buffer
716
- ? mongodb . Binary
717
- : T extends Types . DocumentArray < infer ItemType >
718
- ? Types . DocumentArray < BufferToBinary < ItemType > >
719
- : T extends Types . Subdocument < unknown , unknown , infer SubdocType >
720
- ? HydratedSingleSubdocument < BufferToBinary < SubdocType > >
721
- : BufferToBinary < T > ;
715
+ export type BufferToBinaryProperty < T > = unknown extends Buffer
716
+ ? T
717
+ : T extends Buffer
718
+ ? mongodb . Binary
719
+ : T extends Types . DocumentArray < infer ItemType >
720
+ ? Types . DocumentArray < BufferToBinary < ItemType > >
721
+ : T extends Types . Subdocument < unknown , unknown , infer SubdocType >
722
+ ? HydratedSingleSubdocument < BufferToBinary < SubdocType > >
723
+ : BufferToBinary < T > ;
722
724
723
725
/**
724
726
* Converts any Buffer properties into mongodb.Binary instances, which is what `lean()` returns
725
727
*/
726
- export type BufferToBinary < T > = T extends Buffer
727
- ? mongodb . Binary
728
- : T extends Document
729
- ? T
730
- : T extends TreatAsPrimitives
731
- ? T
732
- : T extends Record < string , any >
733
- ? {
734
- [ K in keyof T ] : BufferToBinaryProperty < T [ K ] >
735
- }
736
- : T ;
728
+ export type BufferToBinary < T > = unknown extends Buffer
729
+ ? T
730
+ : T extends Buffer
731
+ ? mongodb . Binary
732
+ : T extends Document
733
+ ? T
734
+ : T extends TreatAsPrimitives
735
+ ? T
736
+ : T extends Record < string , any >
737
+ ? {
738
+ [ K in keyof T ] : BufferToBinaryProperty < T [ K ] >
739
+ }
740
+ : T ;
737
741
738
742
/**
739
- * Converts any Buffer properties into { type: 'buffer', data: [1, 2, 3] } format for JSON serialization
740
- */
741
- export type BufferToJSON < T > = T extends Buffer
742
- ? { type : 'buffer' , data : number [ ] }
743
- : T extends Document
744
- ? T
745
- : T extends TreatAsPrimitives
743
+ * Converts any Buffer properties into { type: 'buffer', data: [1, 2, 3] } format for JSON serialization
744
+ */
745
+ export type BufferToJSON < T > = unknown extends Buffer
746
+ ? T
747
+ : T extends Buffer
748
+ ? { type : 'buffer' , data : number [ ] }
749
+ : T extends Document
746
750
? T
747
- : T extends Record < string , any > ? {
748
- [ K in keyof T ] : T [ K ] extends Buffer
749
- ? { type : 'buffer' , data : number [ ] }
750
- : T [ K ] extends Types . DocumentArray < infer ItemType >
751
- ? Types . DocumentArray < BufferToBinary < ItemType > >
752
- : T [ K ] extends Types . Subdocument < unknown , unknown , infer SubdocType >
753
- ? HydratedSingleSubdocument < SubdocType >
754
- : BufferToBinary < T [ K ] > ;
755
- } : T ;
751
+ : T extends TreatAsPrimitives
752
+ ? T
753
+ : T extends Record < string , any > ? {
754
+ [ K in keyof T ] : T [ K ] extends Buffer
755
+ ? { type : 'buffer' , data : number [ ] }
756
+ : T [ K ] extends Types . DocumentArray < infer ItemType >
757
+ ? Types . DocumentArray < BufferToBinary < ItemType > >
758
+ : T [ K ] extends Types . Subdocument < unknown , unknown , infer SubdocType >
759
+ ? HydratedSingleSubdocument < SubdocType >
760
+ : BufferToBinary < T [ K ] > ;
761
+ } : T ;
756
762
757
763
/**
758
764
* Converts any ObjectId properties into strings for JSON serialization
0 commit comments