Package imports
All checks were successful
Lint / lint (push) Successful in 11s

This commit is contained in:
Julien Valverdé
2024-06-18 02:36:01 +02:00
parent ed2de8a0f6
commit a2d7afa6cd
7 changed files with 48 additions and 38 deletions

View File

@@ -1,5 +1,4 @@
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 { HasFields } from "./util"
@@ -7,33 +6,33 @@ import type { HasFields } from "./util"
export interface IMutableClass<
Self,
Fields extends Struct.Fields,
Fields extends S.Struct.Fields,
I, R, C,
Inherited,
Proto,
>
extends Omit<
StaticType<Class<Self, Fields, I, R, C, Inherited, Proto>>,
StaticType<S.Class<Self, Fields, I, R, C, Inherited, Proto>>,
"extend"
>
{
new(
...args: ConstructorParameters<Class<Self, Fields, I, R, C, Inherited, Proto>>
...args: ConstructorParameters<S.Class<Self, Fields, I, R, C, Inherited, Proto>>
): Omit<
InstanceType<Class<Self, Fields, I, R, C, Inherited, Proto>>,
InstanceType<S.Class<Self, Fields, I, R, C, Inherited, Proto>>,
keyof Fields
> &
Mutable<Struct.Type<Fields>>
Mutable<S.Struct.Type<Fields>>
extend<Extended>(identifier: string): <newFields extends Struct.Fields>(
extend<Extended>(identifier: string): <newFields extends S.Struct.Fields>(
fields: newFields | HasFields<newFields>,
annotations?: Annotations.Schema<Extended>,
annotations?: S.Annotations.Schema<Extended>,
) => IMutableClass<
Extended,
Fields & newFields,
I & Struct.Encoded<newFields>,
R | Struct.Context<newFields>,
C & Struct.Constructor<newFields>,
I & S.Struct.Encoded<newFields>,
R | S.Struct.Context<newFields>,
C & S.Struct.Constructor<newFields>,
Self,
Proto
>
@@ -41,15 +40,15 @@ extends Omit<
export const MutableClass = S.Class as <Self>(identifier: string) =>
<Fields extends Struct.Fields>(
<Fields extends S.Struct.Fields>(
fieldsOr: Fields | HasFields<Fields>,
annotations?: Annotations.Schema<Self>,
annotations?: S.Annotations.Schema<Self>,
) => IMutableClass<
Self,
Fields,
Struct.Encoded<Fields>,
Struct.Context<Fields>,
Struct.Constructor<Fields>,
S.Struct.Encoded<Fields>,
S.Struct.Context<Fields>,
S.Struct.Constructor<Fields>,
{},
{}
>