Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Commit

Permalink
fix: import * from Joi (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylealwyn authored Oct 17, 2019
1 parent 85193a3 commit c57b27f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Joi, { JoiObject, SchemaMap } from 'joi';
import * as Joi from 'joi';
import { Router, Request, Response, NextFunction } from 'express';

interface Route {
Expand Down Expand Up @@ -101,7 +101,7 @@ export const contentType = (contentType: string) => {
};
};

export const validate = (schema: JoiObject | SchemaMap) => {
export const validate = (schema: Joi.JoiObject | Joi.SchemaMap) => {
return (target: any, _: string, descriptor: PropertyDescriptor) => {
let fn = descriptor.value;

Expand All @@ -111,7 +111,7 @@ export const validate = (schema: JoiObject | SchemaMap) => {
try {
Joi.assert(
payload,
schema.isJoi ? schema : Joi.object(schema as SchemaMap)
schema.isJoi ? schema : Joi.object(schema as Joi.SchemaMap)
);

return fn.apply(target, [req, res, ...rest]);
Expand Down

0 comments on commit c57b27f

Please sign in to comment.