diff --git a/src/effect/schema/class/Mutable.ts b/src/effect/schema/class/Mutable.ts index e69de29..d041490 100644 --- a/src/effect/schema/class/Mutable.ts +++ b/src/effect/schema/class/Mutable.ts @@ -0,0 +1,62 @@ +import { Schema as S } from "@effect/schema" +import type { Annotations, Class, Struct } from "@effect/schema/Schema" +import type { Mutable } from "effect/Types" +import type { Constructor } from "type-fest" +import type { StaticType } from "../../.." +import type { HasFields, MissingSelfGeneric } from "./util" + + +export type TMutableClass< + Self, + Fields extends Struct.Fields, + I, R, C, + Inherited, + Proto, +> = ( + Constructor< + Omit< + InstanceType>, + keyof Fields + > & + Mutable>, + + ConstructorParameters> + > & + + Omit< + StaticType>, + "extend" + > & { + extend(identifier: string): ( + fields: newFields | HasFields, + annotations?: Annotations.Schema, + ) => [Extended] extends [never] + ? MissingSelfGeneric<"Base.extend"> + : TMutableClass< + Extended, + Fields & newFields, + I & Struct.Encoded, + R | Struct.Context, + C & Struct.Constructor, + Self, + Proto + > + } +) + + +export function Mutable< + This extends Class, + + Self, + Fields extends Struct.Fields, + I, R, C, + Inherited, + Proto, +>( + class_: + | This + | Class +) { + +}