diff --git a/package.json b/package.json index 90bd80e..6f6c862 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/validator", - "version": "4.0.0", + "version": "4.1.0", "description": "Template for new projects.", "license": "MIT", "author": "João Lenon ", diff --git a/src/index.ts b/src/index.ts index 2beb203..dd97666 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,6 +8,7 @@ */ import vine, { + Vine, VineAny, VineDate, VineEnum, @@ -33,6 +34,7 @@ export * from '#src/exceptions/ValidationException' export { vine, + Vine, VineAny, VineDate, VineEnum, diff --git a/src/validator/ValidatorImpl.ts b/src/validator/ValidatorImpl.ts index 52fc7d8..374f45a 100644 --- a/src/validator/ValidatorImpl.ts +++ b/src/validator/ValidatorImpl.ts @@ -7,8 +7,11 @@ * file that was distributed with this source code. */ +/* eslint-disable no-use-before-define */ + import { vine, + Vine, VineAccepted, VineAny, VineArray, @@ -25,6 +28,21 @@ import { import type { ExtendHandlerType } from '#src/types' +type ExtendReturnType = { + accepted: (name: string, handler: ExtendHandlerType) => ValidatorImpl + date: (name: string, handler: ExtendHandlerType) => ValidatorImpl + record: (name: string, handler: ExtendHandlerType) => ValidatorImpl + tuple: (name: string, handler: ExtendHandlerType) => ValidatorImpl + literal: (name: string, handler: ExtendHandlerType) => ValidatorImpl + array: (name: string, handler: ExtendHandlerType) => ValidatorImpl + any: (name: string, handler: ExtendHandlerType) => ValidatorImpl + string: (name: string, handler: ExtendHandlerType) => ValidatorImpl + number: (name: string, handler: ExtendHandlerType) => ValidatorImpl + enum: (name: string, handler: ExtendHandlerType) => ValidatorImpl + boolean: (name: string, handler: ExtendHandlerType) => ValidatorImpl + object: (name: string, handler: ExtendHandlerType) => ValidatorImpl +} + export class ValidatorImpl { /** * This getter will return the vine instance to @@ -38,7 +56,7 @@ export class ValidatorImpl { * }) * ``` */ - public get schema() { + public get schema(): Vine { return vine } @@ -63,7 +81,7 @@ export class ValidatorImpl { * }) * ``` */ - public extend() { + public extend(): ExtendReturnType { const macro = (Vine: any, name: string, handler: any) => { Vine.macro(name, handler) }