Skip to content

Instantly share code, notes, and snippets.

@woutgg
Created December 4, 2018 18:04
Show Gist options
  • Save woutgg/786a33065e9b6a9b32ae81add6cfc3ee to your computer and use it in GitHub Desktop.
Save woutgg/786a33065e9b6a9b32ae81add6cfc3ee to your computer and use it in GitHub Desktop.
--- index.d.ts 2018-12-04 17:52:32.000000000 +0100
+++ mongoose-paginate-v2.d.ts 2018-12-04 18:07:14.000000000 +0100
@@ -1,15 +1,29 @@
-// Type definitions for mongoose-paginate 5.0.0
+// Type definitions for mongoose-paginate-v2 1.0.13
// Project: https://github.com/edwardhotchkiss/mongoose-paginate
// Definitions by: Linus Brolin <https://github.com/linusbrolin>, simonxca <https://github.com/simonxca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+//
+// Based on type definitions for mongoose-paginate 5.0.0.
/// <reference types="mongoose" />
declare module 'mongoose' {
+ export interface CustomLabels {
+ totalDocs?: string,
+ limit?: string,
+ page?: string,
+ totalPages?: string,
+ docs?: string,
+ nextPage?: string,
+ prevPage?: string,
+ }
+
export interface PaginateOptions {
select?: Object | string;
sort?: Object | string;
+ customLabels?: CustomLabels,
+ collation?: CollationOptions,
populate?: Array<Object> | Array<string> | Object | string;
lean?: boolean;
leanWithId?: boolean;
@@ -25,6 +39,7 @@
page?: number;
pages?: number;
offset?: number;
+ [customLabel: string]: Array<T> | number | undefined;
}
interface PaginateModel<T extends Document> extends Model<T> {
@@ -44,7 +59,7 @@
skipInit?: boolean): U;
}
-declare module 'mongoose-paginate' {
+declare module 'mongoose-paginate-v2' {
import mongoose = require('mongoose');
var _: (schema: mongoose.Schema) => void;
export = _;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment