This commit is contained in:
Julien Valverdé
2024-06-12 02:14:19 +02:00
parent fe5a863d9b
commit 0c8b9f3452
7 changed files with 46 additions and 29 deletions

View File

@@ -2,7 +2,7 @@ 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"
import type { HasFields } from "./util"
export type TMutableClass<
@@ -26,19 +26,17 @@ export type TMutableClass<
StaticType<Class<Self, Fields, I, R, C, Inherited, Proto>>,
"extend"
> & {
extend<Extended = never>(identifier: string): <newFields extends Struct.Fields>(
extend<Extended>(identifier: string): <newFields extends Struct.Fields>(
fields: newFields | HasFields<newFields>,
annotations?: Annotations.Schema<Extended>,
) => [Extended] extends [never]
? MissingSelfGeneric<"Base.extend">
: TMutableClass<
Extended,
Fields & newFields,
I & Struct.Encoded<newFields>,
R | Struct.Context<newFields>,
C & Struct.Constructor<newFields>,
Self,
Proto
>
) => TMutableClass<
Extended,
Fields & newFields,
I & Struct.Encoded<newFields>,
R | Struct.Context<newFields>,
C & Struct.Constructor<newFields>,
Self,
Proto
>
}
)