mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Remove tslint rule overrides and fix resulting issues.
The 'ban-types' rule has not been removed because required changes conflict with other declarations (mongodb?).
This commit is contained in:
+20
-25
@@ -1,4 +1,4 @@
|
||||
// Type definitions for mongoose-paginate-v2 1.0.13
|
||||
// Type definitions for mongoose-paginate-v2 1.0
|
||||
// Project: https://github.com/aravindnc/mongoose-paginate-v2
|
||||
// Definitions by: Linus Brolin <https://github.com/linusbrolin>
|
||||
// simonxca <https://github.com/simonxca>
|
||||
@@ -8,25 +8,23 @@
|
||||
//
|
||||
// Based on type declarations 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,
|
||||
interface CustomLabels {
|
||||
totalDocs?: string;
|
||||
limit?: string;
|
||||
page?: string;
|
||||
totalPages?: string;
|
||||
docs?: string;
|
||||
nextPage?: string;
|
||||
prevPage?: string;
|
||||
}
|
||||
|
||||
export interface PaginateOptions {
|
||||
interface PaginateOptions {
|
||||
select?: Object | string;
|
||||
sort?: Object | string;
|
||||
customLabels?: CustomLabels,
|
||||
collation?: CollationOptions,
|
||||
populate?: Array<Object> | Array<string> | Object | string;
|
||||
customLabels?: CustomLabels;
|
||||
collation?: CollationOptions;
|
||||
populate?: Object[] | string[] | Object | string;
|
||||
lean?: boolean;
|
||||
leanWithId?: boolean;
|
||||
offset?: number;
|
||||
@@ -34,29 +32,26 @@ declare module 'mongoose' {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface PaginateResult<T> {
|
||||
docs: Array<T>;
|
||||
interface PaginateResult<T> {
|
||||
docs: T[];
|
||||
total: number;
|
||||
limit: number;
|
||||
page?: number;
|
||||
pages?: number;
|
||||
offset?: number;
|
||||
[customLabel: string]: Array<T> | number | undefined;
|
||||
[customLabel: string]: T[] | number | undefined;
|
||||
}
|
||||
|
||||
interface PaginateModel<T extends Document> extends Model<T> {
|
||||
paginate(query?: Object, options?: PaginateOptions, callback?: (err: any, result: PaginateResult<T>) => void): Promise<PaginateResult<T>>;
|
||||
paginate(query?: object, options?: PaginateOptions, callback?: (err: any, result: PaginateResult<T>) => void): Promise<PaginateResult<T>>;
|
||||
}
|
||||
|
||||
export function model(
|
||||
function model(
|
||||
name: string,
|
||||
schema?: Schema,
|
||||
collection?: string,
|
||||
skipInit?: boolean): PaginateModel<any>;
|
||||
}
|
||||
|
||||
declare module 'mongoose-paginate-v2' {
|
||||
import mongoose = require('mongoose');
|
||||
var _: (schema: mongoose.Schema) => void;
|
||||
export = _;
|
||||
}
|
||||
import mongoose = require('mongoose');
|
||||
export function _(schema: mongoose.Schema): void;
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
import mongoosePaginate = require('mongoose-paginate');
|
||||
import { Router, Request, Response } from 'express';
|
||||
|
||||
|
||||
//#region Test Models
|
||||
interface User extends Document {
|
||||
email: string;
|
||||
@@ -29,20 +28,19 @@ const UserSchema: Schema = new Schema({
|
||||
|
||||
UserSchema.plugin(mongoosePaginate);
|
||||
|
||||
interface UserModel<T extends Document> extends PaginateModel<T> {};
|
||||
interface UserModel<T extends Document> extends PaginateModel<T> {}
|
||||
|
||||
let UserModel: UserModel<User> = model<User>('User', UserSchema) as UserModel<User>;
|
||||
const UserModel: UserModel<User> = model<User>('User', UserSchema) as UserModel<User>;
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Test Paginate
|
||||
let router: Router = Router();
|
||||
const router: Router = Router();
|
||||
|
||||
router.get('/users.json', function(req: Request, res: Response) {
|
||||
let descending: boolean = true;
|
||||
let options: PaginateOptions = {} as PaginateOptions;
|
||||
router.get('/users.json', (req: Request, res: Response) => {
|
||||
const descending = true;
|
||||
const options: PaginateOptions = {};
|
||||
options.select = 'email username';
|
||||
options.sort = { 'username': (descending ? -1 : 1) };
|
||||
options.sort = { username: (descending ? -1 : 1) };
|
||||
options.collation = { locale: 'en_US', strength: 1 };
|
||||
options.populate = '';
|
||||
options.lean = true;
|
||||
@@ -78,6 +76,5 @@ router.get('/users.json', function(req: Request, res: Response) {
|
||||
console.dir(value.docsCustom);
|
||||
return res.json(value);
|
||||
});
|
||||
|
||||
});
|
||||
//#endregion
|
||||
|
||||
@@ -1,79 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"ban-types": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user