<S extends Schema.Constraint>(schema: S): (
input: S["~type.make.in"],
options?: Schema.MakeOptions
) => S["Type"]Creates a synchronous maker for the schema's decoded type side.
When to use
Use to construct decoded schema values synchronously when invalid input
should throw an Error whose cause is SchemaIssue.Issue.
Details
The returned function constructs a value from constructor input and throws an
Error with the SchemaIssue.Issue in its cause when construction fails.
Gotchas
Causes that contain defects, interruptions, or asynchronous work at this
synchronous boundary throw an Error whose cause is the underlying Cause,
instead of being converted to a schema validation error.
export function function make<
S extends Schema.Constraint
>(
schema: S
): (
input: S["~type.make.in"],
options?: Schema.MakeOptions
) => S["Type"]
Creates a synchronous maker for the schema's decoded type side.
When to use
Use to construct decoded schema values synchronously when invalid input
should throw an Error whose cause is SchemaIssue.Issue.
Details
The returned function constructs a value from constructor input and throws an
Error with the SchemaIssue.Issue in its cause when construction fails.
Gotchas
Causes that contain defects, interruptions, or asynchronous work at this
synchronous boundary throw an Error whose cause is the underlying Cause,
instead of being converted to a schema validation error.
make<function (type parameter) S in make<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => S["Type"]S extends import SchemaSchema.type Schema.Constraint = /*unresolved*/ anyConstraint>(schema: S extends Schema.Constraintschema: function (type parameter) S in make<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => 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 make<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => S["Type"]S["~type.make.in"], options: Schema.MakeOptionsoptions?: import SchemaSchema.type Schema.MakeOptions = /*unresolved*/ anyMakeOptions): function (type parameter) S in make<S extends Schema.Constraint>(schema: S): (input: S["~type.make.in"], options?: Schema.MakeOptions) => 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 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
}
const const issue: SchemaIssue.Issueissue = 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,
"Constructor adapter can only throw schema issues"
)
throw new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error(const issue: SchemaIssue.Issueissue.toString(), { ErrorOptions.cause?: SchemaIssue.Issuecause: const issue: SchemaIssue.Issueissue })
}
}