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

@@ -0,0 +1,20 @@
import { Schema as S } from "@effect/schema"
import type { Annotations, Struct } from "@effect/schema/Schema"
import type { HasFields } from "./util"
export function Class<Self>(identifier: string) {
return <Fields extends Struct.Fields>(
fieldsOr: Fields | HasFields<Fields>,
annotations?: Annotations.Schema<Self>,
) =>
S.Class<Self>(identifier)(fieldsOr, annotations) as S.Class<
Self,
Fields,
Struct.Encoded<Fields>,
Struct.Context<Fields>,
Struct.Constructor<Fields>,
{},
{}
>
}