@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user