From dc5c56ddefeb0d3a245b043fdfec439d370e7f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Fri, 14 Jun 2024 02:47:21 +0200 Subject: [PATCH] MutableTaggedClass work --- src/effect/schema/class/MutableTaggedClass.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/effect/schema/class/MutableTaggedClass.ts b/src/effect/schema/class/MutableTaggedClass.ts index b4c3e0e..201441f 100644 --- a/src/effect/schema/class/MutableTaggedClass.ts +++ b/src/effect/schema/class/MutableTaggedClass.ts @@ -1,21 +1,25 @@ import { Schema as S } from "@effect/schema" -import type { Annotations, Struct } from "@effect/schema/Schema" -import type { TMutableClass } from "./TMutableClass" +import type { Annotations, PropertySignature, Struct } from "@effect/schema/Schema" import type { HasFields } from "./util" -export function MutableClass(identifier: string) { - return ( +export function MutableTaggedClass(identifier?: string) { + return < + Tag extends string, + Fields extends Struct.Fields, + >( + tag: Tag, fieldsOr: Fields | HasFields, annotations?: Annotations.Schema, ) => - S.Class(identifier)(fieldsOr, annotations) as TMutableClass< + // S.TaggedClass(identifier)(tag, fieldsOr, annotations) as S.TaggedClass< + // Self, + // Tag, + // { readonly _tag: PropertySignature<":", Tag, never, ":", Tag, true, never> } & Fields + // > + S.TaggedClass(identifier)(tag, fieldsOr, annotations) as S.TaggedClass< Self, - Fields, - Struct.Encoded, - Struct.Context, - Struct.Constructor, - {}, - {} + Tag, + { readonly _tag: PropertySignature<":", Tag, never, ":", Tag, true, never> } & Fields > }