@tree-house/joi
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

Tree House Joi

Custom extended Joi for Typescript.

Installation

Install via npm

import '@tree-house/joi'

Usage

Typescript

The main goal of this package is to provide extensive Typescript types for Joi based on joi-extract-type. By installing the module you'll automatically gain access to these types and be able to use Joi.extractType.

export type MySchemaType = Joi.extractType<typeof anyJoiSchema>;

validateJoiSchema

Compare any value against a Joi schema. Function will throw an error if they do not match.

import { validateJoiSchema } from '@tree-house/joi';

// Schema
const schema = Joi.object({
  name: Joi.string()
    .required()
})

// Object to compare schema against
const myObject = {
  name: 'Hello',
}

// Will pass without issues
validateJoiSchema(myObject, schema)

Bugs

When you find issues, please report them:

Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the ISC License - see the LICENSE.md file for details

Package Sidebar

Install

npm i @tree-house/joi

Weekly Downloads

1

Version

3.0.0

License

ISC

Unpacked Size

19.4 kB

Total Files

8

Last publish

Collaborators

  • bonsai-developers
  • knor-el-snor