0.1.6 (#7)
Some checks failed
Publish / publish (push) Failing after 14s
Lint / lint (push) Successful in 12s

Co-authored-by: Julien Valverdé <julien.valverde@mailo.com>
Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
Julien Valverdé
2024-07-29 18:42:05 +02:00
parent 511f43e3f8
commit 7179913d6d
30 changed files with 232 additions and 250 deletions

View File

@@ -0,0 +1,37 @@
import { Schema } from "@effect/schema"
import type { IMutableClass } from "./MutableClass"
import type { HasFields } from "./util"
export interface IMutableTaggedClass<
Self,
Tag,
Fields extends Schema.Struct.Fields,
>
extends IMutableClass<
Self,
Fields,
Schema.Struct.Encoded<Fields>,
Schema.Struct.Context<Fields>,
Schema.Struct.Constructor<Omit<Fields, "_tag">>,
{},
{}
>
{
readonly _tag: Tag
}
export const MutableTaggedClass = Schema.TaggedClass as <Self>(identifier?: string) =>
<
Tag extends string,
Fields extends Schema.Struct.Fields,
>(
tag: Tag,
fieldsOr: Fields | HasFields<Fields>,
annotations?: Schema.Annotations.Schema<Self>,
) => IMutableTaggedClass<
Self,
Tag,
{ readonly _tag: Schema.PropertySignature<":", Tag, never, ":", Tag, true, never> } & Fields
>