diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index f6253bab1a..54f13bddfc 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -446,7 +446,7 @@ mongooseArray.pull(5, 4, 'hi').$shift(); mongooseArray.push([]).toFixed(); mongooseArray.set(1, 'hi').$shift(); mongooseArray.shift().toLowerCase(); -mongooseArray.sort(function (a: any, b: any) { +mongooseArray.sort(function (a, b) { return a.length - b.length; }).unshift(); mongooseArray.splice(4, 1).unshift(); diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index b8219fa646..e2a6593019 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -1141,7 +1141,7 @@ declare module "mongoose" { * potentially overwritting any changes that happen between when you retrieved the object * and when you save it. */ - sort(compare?: Function): T[]; + sort(compareFn?: (a: T, b: T) => number): T[]; /** * Wraps Array#splice with proper change tracking and casting.