From c652aae2386c5d60664fc69841bedbf16565324c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 26 Feb 2024 00:59:58 +0100 Subject: [PATCH] ZodSchemaClassExtender work --- src/builders/ZodSchemaClassExtender.ts | 4 ++-- src/tests.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/builders/ZodSchemaClassExtender.ts b/src/builders/ZodSchemaClassExtender.ts index cfd2eaa..0fea1d6 100644 --- a/src/builders/ZodSchemaClassExtender.ts +++ b/src/builders/ZodSchemaClassExtender.ts @@ -55,7 +55,7 @@ export class ZodSchemaClassExtender< } return new this.constructor( - this.superclass, + this.superclass as Super, Schemas as unknown as AbstractClass< Simplify< @@ -165,7 +165,7 @@ export class ZodSchemaClassExtender< } return new this.constructor( - this.superclass, + this.superclass as Super, JsonifiableSchemas as unknown as AbstractClass< Simplify< diff --git a/src/tests.ts b/src/tests.ts index fcb3f79..3a392ad 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -3,6 +3,7 @@ import { z } from "zod" import { zodSchemaClass } from "./builders/ZodSchemaClassBuilder" import { dejsonify, jsonify } from "./schema/jsonify" import { MobXObservableZodSchemaObject } from "./traits/MobXObservableZodSchemaObject" +import { StaticMembers } from "./util" const exp = zodSchemaClass @@ -47,7 +48,9 @@ const AdminUserProto = User.extend() defaultValues: v => ({ ...v, name: "Admin" as const }), }) .jsonifiable({ - + jsonifySchema: (s, json) => json.extend({ + prout: s.shape.prout + }) })