From 1f8a92bc663686b66ec38dc1726ea6d8709ea826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 27 Jul 2024 02:59:51 +0200 Subject: [PATCH] Tests --- src/effect/schema/class/Mutable.ts | 13 +++++++------ src/effect/schema/tests.ts | 8 +++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/effect/schema/class/Mutable.ts b/src/effect/schema/class/Mutable.ts index 78bbe1e..78569eb 100644 --- a/src/effect/schema/class/Mutable.ts +++ b/src/effect/schema/class/Mutable.ts @@ -39,17 +39,18 @@ extends Omit< } -type MutableInput< +interface MutableInput< Self, Fields extends Schema.Struct.Fields, I, R, C, Inherited, Proto -> = Omit, - | "extend" - | "transformOrFail" - | "transformOrFailFrom" -> +> extends StaticType> { + new( + props: any, + options?: any, + ): Schema.Struct.Type & Omit & Proto +} export const Mutable = < Self, diff --git a/src/effect/schema/tests.ts b/src/effect/schema/tests.ts index d2fa624..86360b1 100644 --- a/src/effect/schema/tests.ts +++ b/src/effect/schema/tests.ts @@ -12,12 +12,14 @@ import { Mutable } from "./class/Mutable" // MobXObservable // ) {} -class User extends Class("User")({ +const UserProto = Class("User")({ id: S.BigIntFromSelf, role: S.Union(S.Literal("BasicUser"), S.Literal("Admin")), -}) {} +}) -const MutableUser = Mutable(User) +class User extends UserProto {} + +const MutableUser = Mutable(UserProto) const JsonifiableUser = User.pipe( Jsonifiable(S.Struct({