From 795316f8db1d30209985cb517354a29a47513603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 17 Jun 2024 23:13:33 +0200 Subject: [PATCH] Jsonifiable --- src/effect/schema/Jsonifiable.ts | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/effect/schema/Jsonifiable.ts b/src/effect/schema/Jsonifiable.ts index 4241426..347190f 100644 --- a/src/effect/schema/Jsonifiable.ts +++ b/src/effect/schema/Jsonifiable.ts @@ -1,13 +1,26 @@ import { Schema } from "@effect/schema" +import * as TF from "type-fest" + + +const s1 = Schema.Struct({ + prout: Schema.String +}) +s1 satisfies { readonly Type: TF.Jsonifiable } + +const s2 = Schema.Class("s2")({ + prout: Schema.String +}) + +function expectStruct(s: Schema.Struct) {} +expectStruct(s2) export function Jsonifiable< - A, - I, - R, - Fields extends Schema.Struct.Fields + A, I, R, + JsonifiableFields extends Schema.Struct.Fields >( - schema: Schema.Schema + schema: Schema.Schema, + jsonifiable: Schema.Struct & { readonly Type: I }, ) { - + return jsonifiable.pipe(schema) }