14 lines
414 B
TypeScript
14 lines
414 B
TypeScript
import { Schema } from "@effect/schema"
|
|
import type { JsonValue } from "type-fest"
|
|
|
|
|
|
export const toJsonifiable = <
|
|
JsonifiableA,
|
|
JsonifiableI extends JsonValue,
|
|
JsonifiableR,
|
|
>(
|
|
jsonifiableSchema: Schema.Schema<JsonifiableA, JsonifiableI, JsonifiableR>
|
|
) =>
|
|
<A, R>(decodedSchema: Schema.Schema<A, JsonifiableA, R>) =>
|
|
Schema.compose(jsonifiableSchema, decodedSchema, { strict: true })
|