Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
tinacious committed Jul 2, 2020
1 parent 2beeb51 commit e3891ad
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/tsconfig.tsbuildinfo
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@
"affectsGlobalScope": false
},
"../validate.ts": {
"version": "1fa11bb58a8cc77f0e0b669fcc965bc4d235354c37c18bd5e36d50140aeab842",
"signature": "14b459568dd23eba545a2d492ddd4fa0a7818cee9689c3084b33816a1d28099b",
"version": "e574158b3a78b22fdf57d00262520c07fcf1e3f6d8075276831a73bbc76184af",
"signature": "e89f2133d08cc04210d873f2d104e460dbe91fc07fae1fcdcb8c42edd00ba7c6",
"affectsGlobalScope": false
}
},
Expand Down Expand Up @@ -1805,6 +1805,10 @@
"../node_modules/@types/node/ts3.2/fs.d.ts",
"../node_modules/@types/node/ts3.2/util.d.ts",
"../node_modules/@types/node/util.d.ts"
],
"../validate.ts": [
"../node_modules/@types/express/index.d.ts",
"../node_modules/@types/hapi__joi/index.d.ts"
]
},
"semanticDiagnosticsPerFile": [
Expand Down
23 changes: 22 additions & 1 deletion lib/validate.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
export {};
/// <reference types="hapi__joi" />
import { Handler } from 'express';
import { Schema } from '@hapi/joi';
interface Options {
params?: Schema;
body?: Schema;
query?: Schema;
}
interface ExpressJoiValidate {
(schemaOptions: Options): Handler;
}
/**
* Route validation using Joi
* Takes a schema with properties defined using Joi:
* - params
* - body
* - query
* Validates the request properties specified in the schema
* @param {Object} schema { params, body, query }
*/
declare const validate: ExpressJoiValidate;
export default validate;
//# sourceMappingURL=validate.d.ts.map
2 changes: 1 addition & 1 deletion lib/validate.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ var validate = function (schema) { return function (req, res, next) {
// lolz required...
// https://stackoverflow.com/questions/12696236/module-exports-in-typescript
module.exports = validate;
exports.default = validate;
2 changes: 2 additions & 0 deletions validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ const validate: ExpressJoiValidate = (schema) => (req, res, next) => {
// lolz required...
// https://stackoverflow.com/questions/12696236/module-exports-in-typescript
module.exports = validate;

export default validate

0 comments on commit e3891ad

Please sign in to comment.