File tree Expand file tree Collapse file tree 2 files changed +1
-49
lines changed
packages/zod/src/v4/locales Expand file tree Collapse file tree 2 files changed +1
-49
lines changed Original file line number Diff line number Diff line change 11export { default as ar } from "./ar.js" ;
22export { default as az } from "./az.js" ;
33export { default as be } from "./be.js" ;
4+ export { default as bg } from "./bg.js" ;
45export { default as ca } from "./ca.js" ;
56export { default as cs } from "./cs.js" ;
67export { default as da } from "./da.js" ;
Original file line number Diff line number Diff line change 11import * as z from "zod" ;
22
33z ;
4-
5- // export const LinesSchema = <T extends z.ZodType<unknown, any>>(schema: T) =>
6- // z
7- // .string()
8- // .transform((input) => input.trim().split("\n"))
9- // .pipe(z.array(schema));
10-
11- const AType = z . object ( {
12- type : z . literal ( "a" ) ,
13- name : z . string ( ) ,
14- } ) ;
15-
16- const BType = z . object ( {
17- type : z . literal ( "b" ) ,
18- name : z . string ( ) ,
19- } ) ;
20-
21- const CType = z . object ( {
22- type : z . literal ( "c" ) ,
23- name : z . string ( ) ,
24- } ) ;
25-
26- const Schema = z . object ( {
27- type : z . literal ( "special" ) . meta ( { description : "Type" } ) ,
28- config : z . object ( {
29- title : z . string ( ) . meta ( { description : "Title" } ) ,
30- get elements ( ) {
31- return z . array ( z . discriminatedUnion ( "type" , [ AType , BType , CType ] ) ) . meta ( {
32- id : "SpecialElements" ,
33- title : "SpecialElements" ,
34- description : "Array of elements" ,
35- } ) ;
36- } ,
37- } ) ,
38- } ) ;
39-
40- console . log (
41- Schema . parse ( {
42- type : "special" ,
43- config : {
44- title : "Special" ,
45- elements : [
46- { type : "a" , name : "John" } ,
47- { type : "b" , name : "Jane" } ,
48- { type : "c" , name : "Jim" } ,
49- ] ,
50- } ,
51- } )
52- ) ;
You can’t perform that action at this time.
0 commit comments