Mutable
This commit is contained in:
@@ -1,25 +1,21 @@
|
||||
import { Schema as S } from "@effect/schema"
|
||||
import type { Annotations, Struct } from "@effect/schema/Schema"
|
||||
import type { TMutableClass } from "./TMutableClass"
|
||||
import type { HasFields, MissingSelfGeneric } from "./util"
|
||||
import type { HasFields } from "./util"
|
||||
|
||||
|
||||
export function MutableClass<Self = never>(identifier: string) {
|
||||
return <Fields extends Struct.Fields>(
|
||||
fieldsOr: Fields | HasFields<Fields>,
|
||||
annotations?: Annotations.Schema<Self>,
|
||||
): (
|
||||
[Self] extends [never]
|
||||
? MissingSelfGeneric<"Class">
|
||||
: TMutableClass<
|
||||
Self,
|
||||
Fields,
|
||||
Struct.Encoded<Fields>,
|
||||
Struct.Context<Fields>,
|
||||
Struct.Constructor<Fields>,
|
||||
{},
|
||||
{}
|
||||
>
|
||||
) =>
|
||||
S.Class<Self>(identifier)(fieldsOr, annotations)
|
||||
S.Class<Self>(identifier)(fieldsOr, annotations) as TMutableClass<
|
||||
Self,
|
||||
Fields,
|
||||
Struct.Encoded<Fields>,
|
||||
Struct.Context<Fields>,
|
||||
Struct.Constructor<Fields>,
|
||||
{},
|
||||
{}
|
||||
>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user