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