Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added declaration files still not tested * Added declaration to package Json * change folder for declaration * added joi deps
- Loading branch information
1 parent
784b597
commit 6d193aa
Showing
3 changed files
with
1,893 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Oops, something went wrong.