diff --git a/src/Static.ts b/src/Static.ts new file mode 100644 index 0000000..5eb929c --- /dev/null +++ b/src/Static.ts @@ -0,0 +1,8 @@ +import type { AbstractConstructor } from "type-fest" + + +/** + * Represents the static members of a class. + * @template C - A class. + */ +export type Static> = Omit diff --git a/src/effect/schema/MutableClass.ts b/src/effect/schema/MutableClass.ts index 70f5411..4c092b6 100644 --- a/src/effect/schema/MutableClass.ts +++ b/src/effect/schema/MutableClass.ts @@ -1,8 +1,28 @@ 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 { Static } from "../../Static" import type { HasFields, MissingSelfGeneric } from "./util" +type TMutableClass< + Self, + Fields extends Struct.Fields, + I, R, C, + Inherited extends object, + Proto, +> = ( + Constructor< + Mutable> & + Omit + & Proto, + + ConstructorParameters> + > & + Static> +) + export const MutableClass = (identifier: string) => ( ( fieldsOr: Fields | HasFields, @@ -10,7 +30,7 @@ export const MutableClass = (identifier: string) => ( ): ( [Self] extends [never] ? MissingSelfGeneric<"Class"> - : Class< + : TMutableClass< Self, Fields, Struct.Encoded, diff --git a/src/index.ts b/src/index.ts index 336ce12..4e7a00c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1 @@ -export {} +export type { Static } from "./Static"