This commit is contained in:
@@ -2,22 +2,6 @@ import { Schema as S } from "@effect/schema"
|
||||
import * as TF from "type-fest"
|
||||
|
||||
|
||||
const MyObjectStruct = S.Struct({
|
||||
id: S.BigIntFromSelf,
|
||||
name: S.String,
|
||||
})
|
||||
|
||||
class MyObjectClass extends S.Class<MyObjectClass>("MyObjectClass")({
|
||||
id: S.BigIntFromSelf,
|
||||
name: S.String,
|
||||
}) {}
|
||||
|
||||
const MyJsonifiedObject = S.Struct({
|
||||
...MyObjectStruct.fields,
|
||||
id: S.BigInt,
|
||||
})
|
||||
|
||||
|
||||
export function Jsonifiable<
|
||||
A, I, R,
|
||||
JsonifiableA extends I, JsonifiableI extends TF.Jsonifiable, JsonifiableR,
|
||||
@@ -27,18 +11,3 @@ export function Jsonifiable<
|
||||
) {
|
||||
return jsonifiable.pipe(S.compose(schema))
|
||||
}
|
||||
|
||||
export function JsonifiableStruct<
|
||||
A, I, R,
|
||||
JsonifiableA extends I, JsonifiableI extends TF.Jsonifiable, JsonifiableR,
|
||||
JsonifiableFields extends S.Struct.Fields,
|
||||
>(
|
||||
schema: S.Schema<A, I, R>,
|
||||
jsonifiable: S.Struct<JsonifiableFields> & S.Schema<JsonifiableA, JsonifiableI, JsonifiableR>,
|
||||
) {
|
||||
return jsonifiable.pipe(S.compose(schema))
|
||||
}
|
||||
|
||||
|
||||
const MyJsonifiableObject = Jsonifiable(MyObjectStruct, MyJsonifiedObject)
|
||||
const MyJsonifiableObject2 = JsonifiableStruct(MyObjectStruct, MyJsonifiedObject)
|
||||
|
||||
1
src/effect/schema/index.ts
Normal file
1
src/effect/schema/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { Jsonifiable } from "./Jsonifiable"
|
||||
Reference in New Issue
Block a user