1.6 KiB
1.6 KiB
Home | Installation | Usage | Types | Values | Syntax | TypeRegistry | TypeCheck
TypeMap
TypeBox offers an external package for bidirectional mapping between TypeBox, Valibot, and Zod type libraries. It also includes syntax parsing support for Valibot and Zod and supports the Standard Schema specification. For more details on TypeMap, refer to the project repository.
Usage
TypeMap needs to be installed separately
$ npm install @alkdev/typemap
Once installed it offers advanced structural remapping between various runtime type libraries (Example)
import { TypeBox, Syntax, Zod } from "@alkdev/typemap";
const T = TypeBox(`{ x: number, y: number, z: number }`); // const T: TObject<{
// x: TNumber;
// y: TNumber;
// z: TNumber;
// }>
const S = Syntax(T); // const S: '{ x: number, y: number, z: number }'
const R = Zod(S).parse(null); // const R: {
// x: number;
// y: number;
// z: number;
// }
Back to Home