MutableClass
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Schema as S } from "@effect/schema"
|
||||
import type { Annotations, Class, Struct } from "@effect/schema/Schema"
|
||||
import type { Mutable } from "effect/Types"
|
||||
import type { StaticType } from "../../../StaticType"
|
||||
import type { TMutableClass } from "./TMutableClass"
|
||||
import type { HasFields } from "./util"
|
||||
|
||||
|
||||
@@ -17,7 +17,26 @@ extends Omit<
|
||||
"extend"
|
||||
>
|
||||
{
|
||||
new(
|
||||
...args: ConstructorParameters<Class<Self, Fields, I, R, C, Inherited, Proto>>
|
||||
): Omit<
|
||||
InstanceType<Class<Self, Fields, I, R, C, Inherited, Proto>>,
|
||||
keyof Fields
|
||||
> &
|
||||
Mutable<Struct.Type<Fields>>
|
||||
|
||||
extend<Extended>(identifier: string): <newFields extends Struct.Fields>(
|
||||
fields: newFields | HasFields<newFields>,
|
||||
annotations?: Annotations.Schema<Extended>,
|
||||
) => IMutableClass<
|
||||
Extended,
|
||||
Fields & newFields,
|
||||
I & Struct.Encoded<newFields>,
|
||||
R | Struct.Context<newFields>,
|
||||
C & Struct.Constructor<newFields>,
|
||||
Self,
|
||||
Proto
|
||||
>
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +45,7 @@ export function MutableClass<Self>(identifier: string) {
|
||||
fieldsOr: Fields | HasFields<Fields>,
|
||||
annotations?: Annotations.Schema<Self>,
|
||||
) =>
|
||||
S.Class<Self>(identifier)(fieldsOr, annotations) as TMutableClass<
|
||||
S.Class<Self>(identifier)(fieldsOr, annotations) as IMutableClass<
|
||||
Self,
|
||||
Fields,
|
||||
Struct.Encoded<Fields>,
|
||||
|
||||
Reference in New Issue
Block a user