@@ -17,6 +17,7 @@ import {
1717} from './cursor/list_search_indexes_cursor' ;
1818import type { Db } from './db' ;
1919import { MongoAPIError , MongoInvalidArgumentError , MongoOperationTimeoutError } from './error' ;
20+ import { type ExplainCommandOptions , type ExplainVerbosityLike } from './explain' ;
2021import type { MongoClient , PkFactory } from './mongo_client' ;
2122import type {
2223 Abortable ,
@@ -853,31 +854,32 @@ export class Collection<TSchema extends Document = Document> {
853854 */
854855 distinct < Key extends keyof WithId < TSchema > > (
855856 key : Key
856- ) : Promise < Array < Flatten < WithId < TSchema > [ Key ] > > | Document > ;
857+ ) : Promise < Array < Flatten < WithId < TSchema > [ Key ] > > > ;
857858 distinct < Key extends keyof WithId < TSchema > > (
858859 key : Key ,
859860 filter : Filter < TSchema >
860- ) : Promise < Array < Flatten < WithId < TSchema > [ Key ] > > | Document > ;
861+ ) : Promise < Array < Flatten < WithId < TSchema > [ Key ] > > > ;
861862 distinct < Key extends keyof WithId < TSchema > > (
862863 key : Key ,
863864 filter : Filter < TSchema > ,
864865 options : DistinctOptions
865- ) : Promise < Array < Flatten < WithId < TSchema > [ Key ] > > | Document > ;
866+ ) : Promise < Array < Flatten < WithId < TSchema > [ Key ] > > > ;
867+ distinct < Key extends keyof WithId < TSchema > > (
868+ key : Key ,
869+ filter : Filter < TSchema > ,
870+ options : DistinctOptions & { explain : ExplainVerbosityLike | ExplainCommandOptions }
871+ ) : Promise < Document > ;
866872
867873 // Embedded documents overload
868- distinct ( key : string ) : Promise < any [ ] | Document > ;
869- distinct ( key : string , filter : Filter < TSchema > ) : Promise < any [ ] | Document > ;
870- distinct (
871- key : string ,
872- filter : Filter < TSchema > ,
873- options : DistinctOptions
874- ) : Promise < any [ ] | Document > ;
874+ distinct ( key : string ) : Promise < any [ ] > ;
875+ distinct ( key : string , filter : Filter < TSchema > ) : Promise < any [ ] > ;
876+ distinct ( key : string , filter : Filter < TSchema > , options : DistinctOptions ) : Promise < any [ ] > ;
875877
876878 async distinct < Key extends keyof WithId < TSchema > > (
877879 key : Key ,
878880 filter : Filter < TSchema > = { } ,
879881 options : DistinctOptions = { }
880- ) : Promise < any [ ] | Document > {
882+ ) : Promise < any [ ] > {
881883 return await executeOperation (
882884 this . client ,
883885 new DistinctOperation (
0 commit comments