<S extends Schema.Constraint>(schema: S): (
input: S["~type.make.in"],
options?: Schema.MakeOptions
) => Option.Option<S["Type"]>Creates a synchronous maker that returns Option.some with the constructed
value on success, or Option.none when construction fails with schema issues.
When to use
Use when you need to validate schema constructor input and only care whether
construction succeeds, without exposing SchemaIssue.Issue details.
Gotchas
Only causes made entirely of schema issues are converted to Option.none.
Causes that contain defects, interruptions, or asynchronous work at this
synchronous boundary throw an Error whose cause is the underlying Cause.
export function function makeOption<
S extends Schema.Constraint
>(
schema: S
): (
input: S["~type.make.in"],
options?: Schema.MakeOptions
) => Option.Option<S["Type"]>
Creates a synchronous maker that returns Option.some with the constructed
value on success, or Option.none when construction fails with schema issues.
When to use
Use when you need to validate schema constructor input and only care whether
construction succeeds, without exposing SchemaIssue.Issue details.
Gotchas
Only causes made entirely of schema issues are converted to Option.none.
Causes that contain defects, interruptions, or asynchronous work at this
synchronous boundary throw an Error whose cause is the underlying Cause.
makeOption<function (type parameter) S in makeOption<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => Option.Option<S["Type"]>S extends import SchemaSchema.type Schema.Constraint = /*unresolved*/ anyConstraint>(schema: S extends Schema.Constraintschema: function (type parameter) S in makeOption<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => Option.Option<S["Type"]>S) {
const const parser: (
input: S["~type.make.in"],
options?: Schema.MakeOptions
) => Effect.Effect<
S["Type"],
SchemaIssue.Issue,
never
>
parser = function makeEffect<
S extends Schema.Constraint
>(
schema: S
): (
input: S["~type.make.in"],
options?: Schema.MakeOptions
) => Effect.Effect<S["Type"], SchemaIssue.Issue>
Creates an effectful maker for the schema's decoded type side.
When to use
Use to construct decoded schema values in Effect while preserving
construction failures as SchemaIssue.Issue values in the error channel.
Details
The returned function accepts constructor input, applies constructor defaults,
runs type-side validation unless checks are disabled, and fails with a
SchemaIssue.Issue when construction fails.
makeEffect(schema: S extends Schema.Constraintschema)
return (input: S["~type.make.in"]input: function (type parameter) S in makeOption<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => Option.Option<S["Type"]>S["~type.make.in"], options: Schema.MakeOptionsoptions?: import SchemaSchema.type Schema.MakeOptions = /*unresolved*/ anyMakeOptions): import OptionOption.type Option.Option = /*unresolved*/ anyOption<function (type parameter) S in makeOption<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => Option.Option<S["Type"]>S["Type"]> => {
const const exit: Exit.Exit<
S["Type"],
SchemaIssue.Issue
>
exit = import EffectEffect.runSyncExit(const parser: (
input: S["~type.make.in"],
options?: Schema.MakeOptions
) => Effect.Effect<
S["Type"],
SchemaIssue.Issue,
never
>
parser(input: S["~type.make.in"]input, options: Schema.MakeOptionsoptions))
if (import ExitExit.isSuccess(const exit: Exit.Exit<
S["Type"],
SchemaIssue.Issue
>
exit)) {
return import OptionOption.some(const exit: Exit.Success<
S["Type"],
SchemaIssue.Issue
>
const exit: {
_tag: "Success";
value: A;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
exit.value)
}
import InternalSchemaCauseInternalSchemaCause.function getSchemaIssueOrThrow(
cause: Cause.Cause<SchemaIssue.Issue>,
message: string
): SchemaIssue.Issue
getSchemaIssueOrThrow(const exit: Exit.Failure<
S["Type"],
SchemaIssue.Issue
>
const exit: {
_tag: "Failure";
cause: Cause.Cause<E>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
exit.cause, "Option adapter can only return none for schema issues")
return import OptionOption.none()
}
}