HashSet<Value>Schema for hash sets whose values conform to the provided element schema.
export interface interface HashSet<Value extends Constraint>Schema for hash sets whose values conform to the provided element schema.
Type-level representation returned by
HashSet
.
HashSet<function (type parameter) Value in HashSet<Value extends Constraint>Value extends Constraint> extends
interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<Constraint>, Iso = T>Creates a schema for a parametric type (a generic container such as
Array<A>, Option<A>, etc.) by accepting a list of type-parameter schemas
and a decoder factory.
When to use
Use when you are defining a schema for a generic container whose validation
depends on one or more type-parameter schemas.
Details
The outer call declareConstructor<T, E, Iso>() fixes the decoded type T,
the encoded type E, and the optional iso type. The inner call receives:
typeParameters — the concrete schemas for each type variable
run — a factory that, given resolved codecs for each type parameter,
returns a parsing function (u, ast, options) => Effect<T, Issue>
annotations — optional metadata
Type-level representation returned by
declareConstructor
.
declareConstructor<
import HashSet_HashSet_.type HashSet_.HashSet = /*unresolved*/ anyHashSet<function (type parameter) Value in HashSet<Value extends Constraint>Value["Type"]>,
import HashSet_HashSet_.type HashSet_.HashSet = /*unresolved*/ anyHashSet<function (type parameter) Value in HashSet<Value extends Constraint>Value["Encoded"]>,
readonly [function (type parameter) Value in HashSet<Value extends Constraint>Value],
type HashSetIso<
Value extends Constraint
> = readonly Value["Iso"][]
Iso representation used for HashSet schemas: an array of element values
using the element schema's Iso type.
HashSetIso<function (type parameter) Value in HashSet<Value extends Constraint>Value>
>
{
readonly "Rebuild": interface HashSet<Value extends Constraint>Schema for hash sets whose values conform to the provided element schema.
Type-level representation returned by
HashSet
.
HashSet<function (type parameter) Value in HashSet<Value extends Constraint>Value>
readonly HashSet<Value extends Constraint>.value: Value extends Constraintvalue: function (type parameter) Value in HashSet<Value extends Constraint>Value
}
/**
* Iso representation used for `HashSet` schemas: an array of element values
* using the element schema's `Iso` type.
*
* @category HashSet
* @since 4.0.0
*/
export type type HashSetIso<
Value extends Constraint
> = readonly Value["Iso"][]
Iso representation used for HashSet schemas: an array of element values
using the element schema's Iso type.
HashSetIso<function (type parameter) Value in type HashSetIso<Value extends Constraint>Value extends Constraint> = interface ReadonlyArray<T>ReadonlyArray<function (type parameter) Value in type HashSetIso<Value extends Constraint>Value["Iso"]>
/**
* Schema for hash sets whose values conform to the provided element schema.
*
* @category HashSet
* @since 3.10.0
*/
export function function HashSet<
Value extends Constraint
>(value: Value): HashSet<Value>
Schema for hash sets whose values conform to the provided element schema.
HashSet<function (type parameter) Value in HashSet<Value extends Constraint>(value: Value): HashSet<Value>Value extends Constraint>(value: Value extends Constraintvalue: function (type parameter) Value in HashSet<Value extends Constraint>(value: Value): HashSet<Value>Value): interface HashSet<Value extends Constraint>Schema for hash sets whose values conform to the provided element schema.
Type-level representation returned by
HashSet
.
HashSet<function (type parameter) Value in HashSet<Value extends Constraint>(value: Value): HashSet<Value>Value> {
const const schema: declareConstructor<
HashSet_.HashSet<Value["Type"]>,
HashSet_.HashSet<Value["Encoded"]>,
readonly [Value],
HashSetIso<Value>
>
const schema: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<HashSet_.HashSet<Value['Type']>, readonly [Value]>) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], HashSetIso<Value>>;
annotateKey: (annotations: Annotations.Key<HashSet_.HashSet<Value['Type']>>) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], HashSetIso<Value>>;
check: (checks_0: SchemaAST.Check<HashSet_.HashSet<Value['Type']>>, ...checks: Array<SchemaAST.Check<HashSet_.HashSet<Value['Type']>>>) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], H…;
rebuild: (ast: SchemaAST.Declaration) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], HashSetIso<Value>>;
make: (input: HashSet_.HashSet<Value['Type']>, options?: MakeOptions) => HashSet_.HashSet<Value['Type']>;
makeOption: (input: HashSet_.HashSet<Value['Type']>, options?: MakeOptions) => Option_.Option<HashSet_.HashSet<Value['Type']>>;
makeEffect: (input: HashSet_.HashSet<Value['Type']>, options?: MakeOptions) => Effect.Effect<HashSet_.HashSet<Value['Type']>, SchemaError, never>;
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; <…;
}
schema = function declareConstructor<
T,
E = T,
Iso = T
>(): <
TypeParameters extends ReadonlyArray<Constraint>
>(
typeParameters: TypeParameters,
run: (typeParameters: {
readonly [K in keyof TypeParameters]: Codec<
TypeParameters[K]["Type"],
TypeParameters[K]["Encoded"]
>
}) => (
u: unknown,
self: SchemaAST.Declaration,
options: SchemaAST.ParseOptions
) => Effect.Effect<T, SchemaIssue.Issue>,
annotations?: Annotations.Declaration<
T,
TypeParameters
>
) => declareConstructor<T, E, TypeParameters, Iso>
Creates a schema for a parametric type (a generic container such as
Array<A>, Option<A>, etc.) by accepting a list of type-parameter schemas
and a decoder factory.
When to use
Use when you are defining a schema for a generic container whose validation
depends on one or more type-parameter schemas.
Details
The outer call declareConstructor<T, E, Iso>() fixes the decoded type T,
the encoded type E, and the optional iso type. The inner call receives:
typeParameters — the concrete schemas for each type variable
run — a factory that, given resolved codecs for each type parameter,
returns a parsing function (u, ast, options) => Effect<T, Issue>
annotations — optional metadata
declareConstructor<
import HashSet_HashSet_.type HashSet_.HashSet = /*unresolved*/ anyHashSet<function (type parameter) Value in HashSet<Value extends Constraint>(value: Value): HashSet<Value>Value["Type"]>,
import HashSet_HashSet_.type HashSet_.HashSet = /*unresolved*/ anyHashSet<function (type parameter) Value in HashSet<Value extends Constraint>(value: Value): HashSet<Value>Value["Encoded"]>,
type HashSetIso<
Value extends Constraint
> = readonly Value["Iso"][]
Iso representation used for HashSet schemas: an array of element values
using the element schema's Iso type.
HashSetIso<function (type parameter) Value in HashSet<Value extends Constraint>(value: Value): HashSet<Value>Value>
>()(
[value: Value extends Constraintvalue],
([value: Codec<
Value["Type"],
Value["Encoded"],
never,
never
>
(parameter) value: {
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
Rebuild: Codec<T, E, RD, RE>;
Type: T;
Iso: Iso;
ast: Ast;
annotate: (annotations: Annotations.Bottom<Value['Type'], any>) => Codec<Value['Type'], Value['Encoded'], never, never>;
annotateKey: (annotations: Annotations.Key<Value['Type']>) => Codec<Value['Type'], Value['Encoded'], never, never>;
check: (checks_0: SchemaAST.Check<Value['Type']>, ...checks: Array<SchemaAST.Check<Value['Type']>>) => Codec<Value['Type'], Value['Encoded'], never, never>;
rebuild: (ast: SchemaAST.AST) => Codec<Value['Type'], Value['Encoded'], never, never>;
make: (input: unknown, options?: MakeOptions) => Value['Type'];
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<Value['Type']>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<Value['Type'], SchemaError, never>;
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; <…;
}
value]) => {
const const values: $Array<
Codec<
Value["Type"],
Value["Encoded"],
never,
never
>
>
const values: {
Type: ReadonlyArray<S["Type"]>;
Encoded: ReadonlyArray<S["Encoded"]>;
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: ReadonlyArray<S["Iso"]>;
value: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Annotations.Bottom<ReadonlyArray<Value['Type']>, readonly []>) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
annotateKey: (annotations: Annotations.Key<ReadonlyArray<Value['Type']>>) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
check: (checks_0: SchemaAST.Check<ReadonlyArray<Value['Type']>>, ...checks: Array<SchemaAST.Check<ReadonlyArray<Value['Type']>>>) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
rebuild: (ast: SchemaAST.Arrays) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
make: (input: ReadonlyArray<unknown>, options?: MakeOptions) => ReadonlyArray<Value['Type']>;
makeOption: (input: ReadonlyArray<unknown>, options?: MakeOptions) => Option_.Option<ReadonlyArray<Value['Type']>>;
makeEffect: (input: ReadonlyArray<unknown>, options?: MakeOptions) => Effect.Effect<ReadonlyArray<Value['Type']>, SchemaError, never>;
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; <…;
}
values = const ArraySchema: ArrayLambda
<Codec<Value["Type"], Value["Encoded"], never, never>>(self: Codec<Value["Type"], Value["Encoded"], never, never>) => $Array<Codec<Value["Type"], Value["Encoded"], never, never>>
ArraySchema(value: Codec<
Value["Type"],
Value["Encoded"],
never,
never
>
(parameter) value: {
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
Rebuild: Codec<T, E, RD, RE>;
Type: T;
Iso: Iso;
ast: Ast;
annotate: (annotations: Annotations.Bottom<Value['Type'], any>) => Codec<Value['Type'], Value['Encoded'], never, never>;
annotateKey: (annotations: Annotations.Key<Value['Type']>) => Codec<Value['Type'], Value['Encoded'], never, never>;
check: (checks_0: SchemaAST.Check<Value['Type']>, ...checks: Array<SchemaAST.Check<Value['Type']>>) => Codec<Value['Type'], Value['Encoded'], never, never>;
rebuild: (ast: SchemaAST.AST) => Codec<Value['Type'], Value['Encoded'], never, never>;
make: (input: unknown, options?: MakeOptions) => Value['Type'];
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<Value['Type']>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<Value['Type'], SchemaError, never>;
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; <…;
}
value)
return (input: unknowninput, ast: SchemaAST.Declaration(parameter) ast: {
_tag: 'Declaration';
typeParameters: ReadonlyArray<AST>;
run: (typeParameters: ReadonlyArray<AST>) => (input: unknown, self: Declaration, options: ParseOptions) => Effect.Effect<any, SchemaIssue.Issue, any>;
encodingChecks: Checks | undefined;
getParser: () => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Declaration;
recur: (recur: (ast: AST) => AST) => Declaration;
flip: (recur: (ast: AST) => AST) => Declaration;
getExpected: () => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
ast, options: SchemaAST.ParseOptions(parameter) options: {
errors: "first" | "all" | undefined;
onExcessProperty: "ignore" | "error" | "preserve" | undefined;
propertyOrder: "none" | "original" | undefined;
disableChecks: boolean | undefined;
concurrency: number | "unbounded" | undefined;
}
options) => {
if (import HashSet_HashSet_.isHashSet(input: unknowninput)) {
return import EffectEffect.mapBothEager(
import SchemaParserSchemaParser.function decodeUnknownEffect<
S extends Schema.Constraint
>(
schema: S,
options?: SchemaAST.ParseOptions
): (
input: unknown,
options?: SchemaAST.ParseOptions
) => Effect.Effect<
S["Type"],
SchemaIssue.Issue,
S["DecodingServices"]
>
Creates an effectful decoder for unknown input.
When to use
Use when you need to decode untyped boundary input in an Effect whose
failure channel is SchemaIssue.Issue, while preserving transformations
and service requirements.
Details
The returned function succeeds with the schema's decoded Type or fails with a
SchemaIssue.Issue. Decoding service requirements are preserved in the returned
Effect. Parse options may be provided when creating the decoder and overridden
when applying it.
decodeUnknownEffect(const values: $Array<
Codec<
Value["Type"],
Value["Encoded"],
never,
never
>
>
const values: {
Type: ReadonlyArray<S["Type"]>;
Encoded: ReadonlyArray<S["Encoded"]>;
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: ReadonlyArray<S["Iso"]>;
value: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Annotations.Bottom<ReadonlyArray<Value['Type']>, readonly []>) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
annotateKey: (annotations: Annotations.Key<ReadonlyArray<Value['Type']>>) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
check: (checks_0: SchemaAST.Check<ReadonlyArray<Value['Type']>>, ...checks: Array<SchemaAST.Check<ReadonlyArray<Value['Type']>>>) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
rebuild: (ast: SchemaAST.Arrays) => $Array<Codec<Value['Type'], Value['Encoded'], never, never>>;
make: (input: ReadonlyArray<unknown>, options?: MakeOptions) => ReadonlyArray<Value['Type']>;
makeOption: (input: ReadonlyArray<unknown>, options?: MakeOptions) => Option_.Option<ReadonlyArray<Value['Type']>>;
makeEffect: (input: ReadonlyArray<unknown>, options?: MakeOptions) => Effect.Effect<ReadonlyArray<Value['Type']>, SchemaError, never>;
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; <…;
}
values)(import ArrArr.fromIterable(input: HashSet_.HashSet<unknown>(parameter) input: {
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;
}
input), options: SchemaAST.ParseOptions(parameter) options: {
errors: "first" | "all" | undefined;
onExcessProperty: "ignore" | "error" | "preserve" | undefined;
propertyOrder: "none" | "original" | undefined;
disableChecks: boolean | undefined;
concurrency: number | "unbounded" | undefined;
}
options),
{
onSuccess: <V>(values: Iterable<V>) => HashSet<V>onSuccess: import HashSet_HashSet_.fromIterable,
onFailure: (issue: any) => SchemaIssue.CompositeonFailure: (issue: SchemaIssue.Issueissue) =>
new import SchemaIssueSchemaIssue.constructor Composite(ast: SchemaAST.AST, actual: StandardJSONSchemaV1<unknown>, issues: readonly [SchemaIssue.Issue, ...Array<SchemaIssue.Issue>]): SchemaIssue.CompositeRepresents a schema issue that groups multiple child issues under a single schema node.
When to use
Use when you need to walk the issue tree for struct/tuple schemas that collect
all field errors rather than failing on the first.
Details
issues is a non-empty readonly array (at least one child).
actual is Option.some(value) when the input was present, or
Option.none() when absent.
- Formatters flatten
Composite by recursing into each child.
Composite(ast: SchemaAST.Declaration(parameter) ast: {
_tag: 'Declaration';
typeParameters: ReadonlyArray<AST>;
run: (typeParameters: ReadonlyArray<AST>) => (input: unknown, self: Declaration, options: ParseOptions) => Effect.Effect<any, SchemaIssue.Issue, any>;
encodingChecks: Checks | undefined;
getParser: () => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Declaration;
recur: (recur: (ast: AST) => AST) => Declaration;
flip: (recur: (ast: AST) => AST) => Declaration;
getExpected: () => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
ast, import Option_Option_.some(input: HashSet_.HashSet<unknown>(parameter) input: {
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;
}
input), [new import SchemaIssueSchemaIssue.constructor Pointer(path: ReadonlyArray<PropertyKey>, issue: SchemaIssue.Issue): SchemaIssue.PointerWraps an inner
Issue
with a property-key path, indicating where in
a nested structure the error occurred.
When to use
Use when you need to walk the issue tree to accumulate path segments for error
reporting.
Details
path is an array of property keys (strings, numbers, or symbols).
- Has no
actual value —
getActual
returns Option.none().
- Formatters concatenate nested
Pointer paths into a single path like
["a"]["b"][0].
Pointer(["values"], issue: SchemaIssue.Issueissue)])
}
)
}
return import EffectEffect.fail(new import SchemaIssueSchemaIssue.constructor InvalidType(ast: SchemaAST.AST, actual: StandardJSONSchemaV1<unknown>): SchemaIssue.InvalidTypeRepresents a schema issue produced when the runtime type of the input does not match the type
expected by the schema (e.g. got null when string was expected).
When to use
Use when you need to detect basic type mismatches, such as a wrong primitive
or null where an object was expected.
Details
ast is the schema node that expected a different type.
actual is Option.some(value) when the input was present, or
Option.none() when no value was provided.
- The default formatter renders this as
"Expected <type>, got <actual>".
Example (Formatting output)
import { Schema } from "effect"
try {
Schema.decodeUnknownSync(Schema.String)(42)
} catch (e) {
if (Schema.isSchemaError(e)) {
console.log(String(e.issue))
// "Expected string, got 42"
}
}
InvalidType(ast: SchemaAST.Declaration(parameter) ast: {
_tag: 'Declaration';
typeParameters: ReadonlyArray<AST>;
run: (typeParameters: ReadonlyArray<AST>) => (input: unknown, self: Declaration, options: ParseOptions) => Effect.Effect<any, SchemaIssue.Issue, any>;
encodingChecks: Checks | undefined;
getParser: () => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Declaration;
recur: (recur: (ast: AST) => AST) => Declaration;
flip: (recur: (ast: AST) => AST) => Declaration;
getExpected: () => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
ast, import Option_Option_.some(input: unknowninput)))
}
},
{
Annotations.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]>.typeConstructor?: {
readonly [key: string]: unknown;
readonly _tag: string;
} | undefined
typeConstructor: {
_tag: string_tag: "effect/HashSet"
},
Annotations.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]>.generation?: {
readonly runtime: string;
readonly Type: string;
readonly Encoded?: string | undefined;
readonly importDeclaration?: string | undefined;
} | undefined
generation: {
runtime: stringruntime: `Schema.HashSet(?)`,
type Type: stringType: `HashSet.HashSet<?>`
},
Annotations.Augment.expected?: string | undefinedHuman-readable description of what a value is expected to satisfy.
Details
For filter and refinement failures, the default formatter uses
message first, then expected, and finally falls back to <filter>.
Use this to name a failed filter in the default message:
Expected <expected>, got <actual>.
expected: "HashSet",
Annotations.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]>.toCodec?: ((typeParameters: readonly [Codec<Value["Encoded"], Value["Encoded"], never, never>]) => SchemaAST.Link) | undefinedtoCodec: ([value: Codec<
Value["Encoded"],
Value["Encoded"],
never,
never
>
(parameter) value: {
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
Rebuild: Codec<T, E, RD, RE>;
Type: T;
Iso: Iso;
ast: Ast;
annotate: (annotations: Annotations.Bottom<Value['Encoded'], any>) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
annotateKey: (annotations: Annotations.Key<Value['Encoded']>) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
check: (checks_0: SchemaAST.Check<Value['Encoded']>, ...checks: Array<SchemaAST.Check<Value['Encoded']>>) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
rebuild: (ast: SchemaAST.AST) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
make: (input: unknown, options?: MakeOptions) => Value['Encoded'];
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<Value['Encoded']>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<Value['Encoded'], SchemaError, never>;
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; <…;
}
value]) =>
function link<T>(): <
To extends Constraint
>(
encodeTo: To,
transformation: {
readonly decode: SchemaGetter.Getter<
T,
NoInfer<To["Type"]>
>
readonly encode: SchemaGetter.Getter<
NoInfer<To["Type"]>,
T
>
}
) => SchemaAST.Link
Constructs an SchemaAST.Link that describes how a value of type T encodes to and decodes from a To schema.
Used when building low-level AST transformations that bridge two schema types.
link<import HashSet_HashSet_.type HashSet_.HashSet = /*unresolved*/ anyHashSet<function (type parameter) Value in HashSet<Value extends Constraint>(value: Value): HashSet<Value>Value["Encoded"]>>()(
const ArraySchema: ArrayLambda
<Codec<Value["Encoded"], Value["Encoded"], never, never>>(self: Codec<Value["Encoded"], Value["Encoded"], never, never>) => $Array<Codec<Value["Encoded"], Value["Encoded"], never, never>>
ArraySchema(value: Codec<
Value["Encoded"],
Value["Encoded"],
never,
never
>
(parameter) value: {
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
Rebuild: Codec<T, E, RD, RE>;
Type: T;
Iso: Iso;
ast: Ast;
annotate: (annotations: Annotations.Bottom<Value['Encoded'], any>) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
annotateKey: (annotations: Annotations.Key<Value['Encoded']>) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
check: (checks_0: SchemaAST.Check<Value['Encoded']>, ...checks: Array<SchemaAST.Check<Value['Encoded']>>) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
rebuild: (ast: SchemaAST.AST) => Codec<Value['Encoded'], Value['Encoded'], never, never>;
make: (input: unknown, options?: MakeOptions) => Value['Encoded'];
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<Value['Encoded']>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<Value['Encoded'], SchemaError, never>;
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; <…;
}
value),
import SchemaTransformationSchemaTransformation.function transform<T, E>(options: {
readonly decode: (input: E) => T
readonly encode: (input: T) => E
}): Transformation<T, E>
Creates a Transformation from pure (sync, infallible) decode and encode
functions.
When to use
Use when you need an infallible schema transformation that does not require
Effect services.
Details
- Each function receives the input and returns the output directly.
- Skips
None inputs (missing keys) — functions are only called on present values.
- Does not allocate Effects internally; uses optimized sync path.
Example (Converting between cents and dollars)
import { Schema, SchemaTransformation } from "effect"
const CentsFromDollars = Schema.Number.pipe(
Schema.decodeTo(
Schema.Number,
SchemaTransformation.transform({
decode: (dollars) => dollars * 100,
encode: (cents) => cents / 100
})
)
)
transform({
decode: <V>(values: Iterable<V>) => HashSet<V>decode: import HashSet_HashSet_.fromIterable,
encode: (
input: any
) => NoInfer<readonly Value["Encoded"][]>
encode: import ArrArr.fromIterable
})
),
Annotations.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]>.toArbitrary?: Annotations.ToArbitrary.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]> | undefinedtoArbitrary: ([value: Annotations.ToArbitrary.TypeParameter<
Value["Type"]
>
(parameter) value: {
arbitrary: FastCheck.Arbitrary<T>;
terminal: FastCheck.Arbitrary<T> | undefined;
}
value]) => (fc: typeof FastCheckfc, ctx: Annotations.ToArbitrary.Context(parameter) ctx: {
constraint: ToArbitrary.GenerationConstraint | undefined;
recursion: ToArbitrary.Recursion | undefined;
}
ctx) =>
function collectionArbitrary<
unknown,
unknown
>(
fc: typeof FastCheck,
ctx: Annotations.ToArbitrary.Context,
item: FastCheck.Arbitrary<unknown>,
terminalItem:
| FastCheck.Arbitrary<unknown>
| undefined,
fromIterable: (items: unknown[]) => unknown,
comparator?:
| ((a: unknown, b: unknown) => boolean)
| undefined
): {
arbitrary: any
terminal: any
}
collectionArbitrary(fc: typeof FastCheckfc, ctx: Annotations.ToArbitrary.Context(parameter) ctx: {
constraint: ToArbitrary.GenerationConstraint | undefined;
recursion: ToArbitrary.Recursion | undefined;
}
ctx, value: Annotations.ToArbitrary.TypeParameter<
Value["Type"]
>
(parameter) value: {
arbitrary: FastCheck.Arbitrary<T>;
terminal: FastCheck.Arbitrary<T> | undefined;
}
value.Annotations.ToArbitrary.TypeParameter<T>.arbitrary: FastCheck.Arbitrary<T>arbitrary, value: Annotations.ToArbitrary.TypeParameter<
Value["Type"]
>
(parameter) value: {
arbitrary: FastCheck.Arbitrary<T>;
terminal: FastCheck.Arbitrary<T> | undefined;
}
value.Annotations.ToArbitrary.TypeParameter<T>.terminal: anyterminal, import HashSet_HashSet_.fromIterable, import EqualEqual.equals),
Annotations.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]>.toEquivalence?: Annotations.ToEquivalence.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]> | undefinedtoEquivalence: ([value: Equivalence.Equivalence<Value["Type"]>value]) => import EqualEqual.makeCompareSet(value: Equivalence.Equivalence<Value["Type"]>value),
Annotations.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]>.toFormatter?: Annotations.ToFormatter.Declaration<HashSet_.HashSet<Value["Type"]>, readonly [Value]> | undefinedtoFormatter: ([value: Formatter<Value["Type"], string>value]) => (t: HashSet_.HashSet<Value["Type"]>(parameter) t: {
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;
}
t) => {
const const size: anysize = import HashSet_HashSet_.size(t: HashSet_.HashSet<Value["Type"]>(parameter) t: {
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;
}
t)
if (const size: anysize === 0) {
return "HashSet(0) {}"
}
const const values: string[]values = module globalThisglobalThis.var Array: ArrayConstructorArray.ArrayConstructor.from<unknown>(iterable: Iterable<unknown> | ArrayLike<unknown>): unknown[] (+3 overloads)Creates an array from an iterable object.
from(t: HashSet_.HashSet<Value["Type"]>(parameter) t: {
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;
}
t).Array<unknown>.sort(compareFn?: ((a: unknown, b: unknown) => number) | undefined): unknown[]Sorts an array in place.
This method mutates the array and returns a reference to the same array.
sort().Array<unknown>.map<string>(callbackfn: (value: unknown, index: number, array: unknown[]) => string, thisArg?: any): string[]Calls a defined callback function on each element of an array, and returns an array that contains the results.
map((v: unknownv) => `${value: Formatter<Value["Type"], string>value(v: unknownv)}`)
return `HashSet(${const size: anysize}) { ${const values: string[]values.Array<string>.join(separator?: string): stringAdds all the elements of an array into a string, separated by the specified separator string.
join(", ")} }`
}
}
)
return const make: <S extends Constraint>(
ast: S["ast"],
options?: object
) => S
Creates a schema from an AST (Abstract Syntax Tree) node.
Details
This is the fundamental constructor for all schemas in the Effect Schema
library. It takes an AST node and wraps it in a fully-typed schema that
preserves all type information and provides the complete schema API.
The make function is used internally to create all primitive schemas like
String, Number, Boolean, etc., as well as more complex schemas. It's
the bridge between the untyped AST representation and the strongly-typed
schema.
make(const schema: declareConstructor<
HashSet_.HashSet<Value["Type"]>,
HashSet_.HashSet<Value["Encoded"]>,
readonly [Value],
HashSetIso<Value>
>
const schema: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<HashSet_.HashSet<Value['Type']>, readonly [Value]>) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], HashSetIso<Value>>;
annotateKey: (annotations: Annotations.Key<HashSet_.HashSet<Value['Type']>>) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], HashSetIso<Value>>;
check: (checks_0: SchemaAST.Check<HashSet_.HashSet<Value['Type']>>, ...checks: Array<SchemaAST.Check<HashSet_.HashSet<Value['Type']>>>) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], H…;
rebuild: (ast: SchemaAST.Declaration) => declareConstructor<HashSet_.HashSet<Value['Type']>, HashSet_.HashSet<Value['Encoded']>, readonly [Value], HashSetIso<Value>>;
make: (input: HashSet_.HashSet<Value['Type']>, options?: MakeOptions) => HashSet_.HashSet<Value['Type']>;
makeOption: (input: HashSet_.HashSet<Value['Type']>, options?: MakeOptions) => Option_.Option<HashSet_.HashSet<Value['Type']>>;
makeEffect: (input: HashSet_.HashSet<Value['Type']>, options?: MakeOptions) => Effect.Effect<HashSet_.HashSet<Value['Type']>, SchemaError, never>;
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; <…;
}
schema.Bottom<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<Value["Encoded"]>, Value["DecodingServices"], Value["EncodingServices"], Declaration, declareConstructor<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<...>, readonly [...], HashSetIso<...>>, ... 8 more ..., "required">["ast"]: SchemaAST.Declaration(property) Bottom<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<Value["Encoded"]>, Value["DecodingServices"], Value["EncodingServices"], Declaration, declareConstructor<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<...>, readonly [...], HashSetIso<...>>, ... 8 more ..., "required">["ast"]: {
_tag: 'Declaration';
typeParameters: ReadonlyArray<AST>;
run: (typeParameters: ReadonlyArray<AST>) => (input: unknown, self: Declaration, options: ParseOptions) => Effect.Effect<any, SchemaIssue.Issue, any>;
encodingChecks: Checks | undefined;
getParser: () => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Declaration;
recur: (recur: (ast: AST) => AST) => Declaration;
flip: (recur: (ast: AST) => AST) => Declaration;
getExpected: () => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
ast, { value: Value extends Constraintvalue })
}