Skip to content

Commit b9dac27

Browse files
authored
Update index.ts
zod unprefixed function names
1 parent 9fdbf5c commit b9dac27

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/zod/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export class ZodSchemaVisitor extends BaseSchemaVisitor {
8787
leave: InterfaceTypeDefinitionBuilder(this.config.withObjectType, (node: InterfaceTypeDefinitionNode) => {
8888
const visitor = this.createVisitor('output');
8989
const name = visitor.convertName(node.name.value);
90+
const functionName = visitor.convertName(node.name.value, {
91+
useTypesPrefix: false,
92+
useTypesSuffix: false,
93+
});
9094
const typeName = visitor.prefixTypeNamespace(name);
9195
this.importTypes.push(name);
9296

@@ -114,7 +118,7 @@ export class ZodSchemaVisitor extends BaseSchemaVisitor {
114118
new DeclarationBlock({})
115119
.export()
116120
.asKind('function')
117-
.withName(`${name}Schema(): z.ZodObject<Properties<${typeName}>>`)
121+
.withName(`${functionName}Schema(): z.ZodObject<Properties<${typeName}>>`)
118122
.withBlock([indent(`return z.object({`), shape, indent('})')].join('\n'))
119123
.string + appendArguments
120124
);

0 commit comments

Comments
 (0)