Jsonifiable
Some checks failed
Lint / lint (push) Failing after 11s

This commit is contained in:
Julien Valverdé
2024-06-17 23:13:33 +02:00
parent 50578acf21
commit 795316f8db

View File

@@ -1,13 +1,26 @@
import { Schema } from "@effect/schema" 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<unknown>("s2")({
prout: Schema.String
})
function expectStruct(s: Schema.Struct<any>) {}
expectStruct(s2)
export function Jsonifiable< export function Jsonifiable<
A, A, I, R,
I, JsonifiableFields extends Schema.Struct.Fields
R,
Fields extends Schema.Struct.Fields
>( >(
schema: Schema.Schema<A, I, R> schema: Schema.Schema<A, I, R>,
jsonifiable: Schema.Struct<JsonifiableFields> & { readonly Type: I },
) { ) {
return jsonifiable.pipe(schema)
} }