// Type definitions for mongoose-paginate 5.0.0 // Project: https://github.com/edwardhotchkiss/mongoose-paginate // Definitions by: Linus Brolin , simonxca // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 /// declare module 'mongoose' { export interface PaginateOptions { select?: Object | string; sort?: Object | string; populate?: | Array | Array | Object | string | QueryPopulateOptions; lean?: boolean; leanWithId?: boolean; offset?: number; page?: number; limit?: number; } interface QueryPopulateOptions { /** space delimited path(s) to populate */ path: string; /** optional fields to select */ select?: any; /** optional query conditions to match */ match?: any; /** optional model to use for population */ model?: string | Model; /** optional query options like sort, limit, etc */ options?: any; /** deep populate */ populate?: QueryPopulateOptions | QueryPopulateOptions[]; } export interface PaginateResult { docs: Array; total: number; limit: number; page?: number; pages?: number; offset?: number; } interface PaginateModel extends Model { paginate(query?: Object, options?: PaginateOptions, callback?: (err: any, result: PaginateResult) => void): Promise>; } export function model( name: string, schema?: Schema, collection?: string, skipInit?: boolean): PaginateModel; export function model>( name: string, schema?: Schema, collection?: string, skipInit?: boolean): U; } declare module 'mongoose-paginate' { import mongoose = require('mongoose'); var _: (schema: mongoose.Schema) => void; export = _; }