Skip to content

Commit

Permalink
Added declaration files (#76)
Browse files Browse the repository at this point in the history
* Added declaration files

still not tested

* Added declaration to package Json

* change folder for declaration

* added joi deps
  • Loading branch information
fega authored and isaachinman committed Jul 30, 2019
1 parent 784b597 commit 6d193aa
Show file tree
Hide file tree
Showing 3 changed files with 1,893 additions and 1 deletion.
41 changes: 41 additions & 0 deletions lib/index.d.ts
@@ -0,0 +1,41 @@
// Type definitions for express-validation
// Project: https://github.com/andrewkeig/express-validation/issues
// Definitions by: Fabian Gutierrez <https://github.com/fega>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { RequestHandler } from "express";
import * as Joi from "joi";
interface ValidatorField {
[key: string]: any;
}
interface Validator {
body?: ValidatorField;
params?: ValidatorField;
query?: ValidatorField;
headers?: ValidatorField;
cookies?: ValidatorField;
options?: {
allowUnknownBody?: boolean;
allowUnknownHeaders?: boolean;
allowUnknownQuery?: boolean;
allowUnknownParams?: boolean;
allowUnknownCookies?: boolean
};
}

declare function validate(validator: Validator): RequestHandler;
declare namespace validate {
export class ValidationError {
errors: Messages[];
status: number;
statusText: string;
message: "validation error";

}
interface Messages {
message: string;
types: string;
}
}

export = validate;

0 comments on commit 6d193aa

Please sign in to comment.