From e3865142f973bd571253ba063e033b2613eef64a Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 21 Jul 2016 10:47:18 -0400 Subject: [PATCH] fix type incompatibility with array.sort() --- mongoose/mongoose-tests.ts | 2 +- mongoose/mongoose.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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.