Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 513 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 513 Bytes

metazod

Provides typed metadata feature to zod. Library installation

npm install --save-dev @codexsoft/metazod 

Usage

Put this code into some *.d.ts file in your project:

import {} from '@codexsoft/metazod';

declare module 'zod' {
    interface IMeta {
        test: number;
        test2: string;
    }
}

Now you can write some typed metadata into schema:

const a = z.string().uuid().meta({test: 1, test2: ''})

And read it:

const b = a.getMeta().test;