Converts @hapi/joi schemas into TypeScript types. Current version 1.1.1, stable with weekly updates. Outputs TypeScript interfaces/types from Joi schema definitions, supporting banner comments, custom interface names, and unknown property handling. Differentiator: eliminates manual translation of Joi validation schemas to TypeScript types, reducing duplication and errors. Requires @hapi/joi 16.x as a peer dependency. Not maintained actively (last update 2019).
npm install joi2typesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates converting a Joi schema for route configuration into a TypeScript type using a custom interface name.
Install @hapi/joi@16 with 'npm install @hapi/joi@16'
Ensure the schema is created with Joi methods (e.g., Joi.object()) before passing to joi2Types
Use require('joi2types').default or switch to ESM importAwait the call: const types = await joi2Types(schema);
Change to const joi2Types = require('joi2types').default;Install @hapi/joi@16 with npm install @hapi/joi@16
Create schema using Joi methods (e.g., Joi.object({...}))