Skip to content

Commit 0877cb5

Browse files
authored
Merge pull request #244 from sschneider-ihre-pvs/main
zod object generic type sync
2 parents 582bea0 + 9125ac1 commit 0877cb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/zod/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const ZodSchemaVisitor = (schema: GraphQLSchema, config: ValidationSchema
6161
.export()
6262
.asKind('function')
6363
.withName(`${name}Schema(): z.ZodObject<Properties<${name}>>`)
64-
.withBlock([indent(`return z.object({`), shape, indent('})')].join('\n')).string;
64+
.withBlock([indent(`return z.object<Properties<${name}>>({`), shape, indent('})')].join('\n')).string;
6565
},
6666
ObjectTypeDefinition: ObjectTypeDefinitionBuilder(config.withObjectType, (node: ObjectTypeDefinitionNode) => {
6767
const name = tsVisitor.convertName(node.name.value);
@@ -75,7 +75,7 @@ export const ZodSchemaVisitor = (schema: GraphQLSchema, config: ValidationSchema
7575
.withName(`${name}Schema(): z.ZodObject<Properties<${name}>>`)
7676
.withBlock(
7777
[
78-
indent(`return z.object({`),
78+
indent(`return z.object<Properties<${name}>>({`),
7979
indent(`__typename: z.literal('${node.name.value}').optional(),`, 2),
8080
shape,
8181
indent('})'),

0 commit comments

Comments
 (0)