@@ -38,6 +38,7 @@ class ZodDeclarationFileBuilder {
38
38
39
39
// we keep track of the schemas we've seen so we can
40
40
// process resolve-ref schemas
41
+ // deno-lint-ignore no-explicit-any
41
42
schemas : Record < string , any > = { } ;
42
43
43
44
// deno-lint-ignore no-explicit-any
@@ -106,18 +107,13 @@ ${zodInferredTypes}`;
106
107
convertSchemaEnum ( schema : any ) : string | undefined {
107
108
// deno-lint-ignore no-explicit-any
108
109
const zodEnumDeclaration = ( values : any [ ] ) => {
109
- // deno-lint-ignore no-explicit-any
110
- const zodEnumValues = values . map ( ( value : any ) => {
111
- return JSON . stringify ( value ) ;
112
- } ) ;
113
-
114
110
// first filter out strings
115
- const zodEnumStrings = zodEnumValues . filter ( ( value ) => {
111
+ const zodEnumStrings = values . filter ( ( value ) => {
116
112
return typeof value === "string" ;
117
113
} ) . map ( ( value ) => {
118
114
return JSON . stringify ( value ) ;
119
115
} ) ;
120
- const zodLiterals = zodEnumValues . filter ( ( x ) => {
116
+ const zodLiterals = values . filter ( ( x ) => {
121
117
return typeof x !== "string" ;
122
118
} ) ;
123
119
const zodTypes : string [ ] = [ ] ;
@@ -131,7 +127,7 @@ ${zodInferredTypes}`;
131
127
zodTypes . push (
132
128
...zodLiterals . map ( ( x ) => {
133
129
return `z.literal(${ JSON . stringify ( x ) } )` ;
134
- } ) . join ( ", " ) ,
130
+ } ) ,
135
131
) ;
136
132
}
137
133
if ( zodTypes . length === 0 ) {
0 commit comments