File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { z } from "zod" ;
2
+
3
+ const LanguagesEnum = z . enum ( [ "Python" , "Java" , "C++" ] ) ;
4
+
5
+ type Languages = z . infer < typeof LanguagesEnum > ;
6
+
7
+ export { LanguagesEnum , type Languages } ;
Original file line number Diff line number Diff line change
1
+ import { z } from "zod" ;
2
+
3
+ const ProficiencyEnum = z . enum ( [ "Beginner" , "Intermediate" , "Advanced" ] ) ;
4
+
5
+ type Proficiency = z . infer < typeof ProficiencyEnum > ;
6
+
7
+ export {
8
+ ProficiencyEnum ,
9
+ type Proficiency ,
10
+ }
Original file line number Diff line number Diff line change
1
+ import { z } from "zod" ;
2
+ import { ProficiencyEnum } from "./Proficiency" ;
3
+ import { LanguagesEnum } from "./Languages" ;
4
+
5
+ const UserSchema = z . object ( {
6
+ username : z . string ( ) ,
7
+ displayName : z . string ( ) ,
8
+ email : z . string ( ) . email ( ) ,
9
+ proficiency : ProficiencyEnum ,
10
+ languages : LanguagesEnum ,
11
+ } ) ;
12
+
13
+ type User = z . infer < typeof UserSchema > ;
14
+
15
+ export { UserSchema , type User } ;
You can’t perform that action at this time.
0 commit comments