@@ -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<unknown>("s2")({
|
||||
prout: Schema.String
|
||||
})
|
||||
|
||||
function expectStruct(s: Schema.Struct<any>) {}
|
||||
expectStruct(s2)
|
||||
|
||||
|
||||
export function Jsonifiable<
|
||||
A,
|
||||
I,
|
||||
R,
|
||||
Fields extends Schema.Struct.Fields
|
||||
A, I, R,
|
||||
JsonifiableFields 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