From 2ad29a147b8cf72123bd056a7e19104635c87715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 29 Jul 2024 14:05:07 +0200 Subject: [PATCH] Cleanup --- src/effect/schema/class/Mutable.ts | 63 ------------------------------ src/effect/schema/tests.ts | 20 +++------- 2 files changed, 5 insertions(+), 78 deletions(-) delete mode 100644 src/effect/schema/class/Mutable.ts diff --git a/src/effect/schema/class/Mutable.ts b/src/effect/schema/class/Mutable.ts deleted file mode 100644 index 78569eb..0000000 --- a/src/effect/schema/class/Mutable.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Schema } from "@effect/schema" -import type { Types } from "effect" -import type { StaticType } from "../../../StaticType" -import type { HasFields } from "./util" - - -export interface MutableClass< - Self, - Fields extends Schema.Struct.Fields, - I, R, C, - Inherited, - Proto, -> -extends Omit< - StaticType>, - "extend" -> -{ - new( - ...args: ConstructorParameters> - ): Omit< - InstanceType>, - keyof Fields - > & - Types.Mutable> - - extend(identifier: string): ( - fields: newFields | HasFields, - annotations?: Schema.Annotations.Schema, - ) => MutableClass< - Extended, - Fields & newFields, - I & Schema.Struct.Encoded, - R | Schema.Struct.Context, - C & Schema.Struct.Constructor, - Self, - Proto - > -} - - -interface MutableInput< - Self, - Fields extends Schema.Struct.Fields, - I, R, C, - Inherited, - Proto -> extends StaticType> { - new( - props: any, - options?: any, - ): Schema.Struct.Type & Omit & Proto -} - -export const Mutable = < - Self, - Fields extends Schema.Struct.Fields, - I, R, C, - Inherited, - Proto ->( - self: MutableInput -) => self as MutableClass diff --git a/src/effect/schema/tests.ts b/src/effect/schema/tests.ts index 86360b1..0e9f692 100644 --- a/src/effect/schema/tests.ts +++ b/src/effect/schema/tests.ts @@ -1,25 +1,15 @@ import { Schema as S } from "@effect/schema" import { reaction, runInAction } from "mobx" import { Jsonifiable } from "./Jsonifiable" -import { Class, MobXObservable, MutableTaggedClass, TaggedClass } from "./class" -import { Mutable } from "./class/Mutable" +import { MobXObservable, MutableTaggedClass } from "./class" -// class User extends MutableTaggedClass()("User", { -// id: S.BigIntFromSelf, -// role: S.Union(S.Literal("BasicUser"), S.Literal("Admin")), -// }).pipe( -// MobXObservable -// ) {} - -const UserProto = Class("User")({ +class User extends MutableTaggedClass()("User", { id: S.BigIntFromSelf, role: S.Union(S.Literal("BasicUser"), S.Literal("Admin")), -}) - -class User extends UserProto {} - -const MutableUser = Mutable(UserProto) +}).pipe( + MobXObservable +) {} const JsonifiableUser = User.pipe( Jsonifiable(S.Struct({