Skip to content

Commit f48a8da

Browse files
committed
apply to yup and zod
1 parent 5ca8d00 commit f48a8da

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/yup/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ export const YupSchemaVisitor = (schema: GraphQLSchema, config: ValidationSchema
2424
return {
2525
buildImports: (): string[] => {
2626
if (config.importFrom && importTypes.length > 0) {
27-
return [importYup, `import { ${importTypes.join(', ')} } from '${config.importFrom}'`];
27+
return [
28+
importYup,
29+
`import ${config.useTypeImports ? 'type ' : ''}{ ${importTypes.join(', ')} } from '${config.importFrom}'`,
30+
];
2831
}
2932
return [importYup];
3033
},

src/zod/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export const ZodSchemaVisitor = (schema: GraphQLSchema, config: ValidationSchema
2525
return {
2626
buildImports: (): string[] => {
2727
if (config.importFrom && importTypes.length > 0) {
28-
return [importZod, `import { ${importTypes.join(', ')} } from '${config.importFrom}'`];
28+
return [
29+
importZod,
30+
`import ${config.useTypeImports ? 'type ' : ''}{ ${importTypes.join(', ')} } from '${config.importFrom}'`,
31+
];
2932
}
3033
return [importZod];
3134
},

0 commit comments

Comments
 (0)