MutableTaggedClass work
This commit is contained in:
@@ -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<Self>(identifier: string) {
|
||||
return <Fields extends Struct.Fields>(
|
||||
export function MutableTaggedClass<Self>(identifier?: string) {
|
||||
return <
|
||||
Tag extends string,
|
||||
Fields extends Struct.Fields,
|
||||
>(
|
||||
tag: Tag,
|
||||
fieldsOr: Fields | HasFields<Fields>,
|
||||
annotations?: Annotations.Schema<Self>,
|
||||
) =>
|
||||
S.Class<Self>(identifier)(fieldsOr, annotations) as TMutableClass<
|
||||
// S.TaggedClass<Self>(identifier)(tag, fieldsOr, annotations) as S.TaggedClass<
|
||||
// Self,
|
||||
// Tag,
|
||||
// { readonly _tag: PropertySignature<":", Tag, never, ":", Tag, true, never> } & Fields
|
||||
// >
|
||||
S.TaggedClass<Self>(identifier)(tag, fieldsOr, annotations) as S.TaggedClass<
|
||||
Self,
|
||||
Fields,
|
||||
Struct.Encoded<Fields>,
|
||||
Struct.Context<Fields>,
|
||||
Struct.Constructor<Fields>,
|
||||
{},
|
||||
{}
|
||||
Tag,
|
||||
{ readonly _tag: PropertySignature<":", Tag, never, ":", Tag, true, never> } & Fields
|
||||
>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user