ParseResult
Constructors
Signature
declare const fail: (issue: ParseIssue) => Either.Either<never, ParseIssue>Signature
declare const fromOption: { (onNone: () => ParseIssue): <A>(self: Option<A>) => Either<A, ParseIssue>; <A>(self: Option<A>, onNone: () => ParseIssue): Either<A, ParseIssue>;}Signature
declare function parseError(issue: ParseIssue): ParseErrorSignature
declare const succeed: <A>(a: A) => Either.Either<A, ParseIssue>Decoding
Signature
declare const decode: <A, I, R>(schema: Schema.Schema<A, I, R>, options?: AST.ParseOptions) => (i: I, overrideOptions?: AST.ParseOptions) => Effect.Effect<A, ParseIssue, R>Signature
declare const decodeEither: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (i: I, overrideOptions?: AST.ParseOptions) => Either.Either<A, ParseIssue>Signature
declare const decodeOption: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (i: I, overrideOptions?: AST.ParseOptions) => Option.Option<A>Signature
declare const decodePromise: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (i: I, overrideOptions?: AST.ParseOptions) => Promise<A>Signature
declare const decodeSync: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (i: I, overrideOptions?: AST.ParseOptions) => ASignature
declare function decodeUnknown<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Effect<A, ParseIssue, R>Signature
declare function decodeUnknownEither<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Either<A, ParseIssue>Signature
declare function decodeUnknownOption<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Option<A>Signature
declare function decodeUnknownPromise<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Promise<A>Signature
declare function decodeUnknownSync<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => AEncoding
Signature
declare const encode: <A, I, R>(schema: Schema.Schema<A, I, R>, options?: AST.ParseOptions) => (a: A, overrideOptions?: AST.ParseOptions) => Effect.Effect<I, ParseIssue, R>Signature
declare const encodeEither: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (a: A, overrideOptions?: AST.ParseOptions) => Either.Either<I, ParseIssue>Signature
declare const encodeOption: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (input: A, overrideOptions?: AST.ParseOptions) => Option.Option<I>Signature
declare const encodePromise: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (a: A, overrideOptions?: AST.ParseOptions) => Promise<I>Signature
declare const encodeSync: <A, I>(schema: Schema.Schema<A, I, never>, options?: AST.ParseOptions) => (a: A, overrideOptions?: AST.ParseOptions) => ISignature
declare function encodeUnknown<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Effect<I, ParseIssue, R>Signature
declare function encodeUnknownEither<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Either<I, ParseIssue>Signature
declare function encodeUnknownOption<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Option<I>Signature
declare function encodeUnknownPromise<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Promise<I>Signature
declare function encodeUnknownSync<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => IFormatting
Signature
declare const ArrayFormatter: ParseResultFormatter<Array<ArrayFormatterIssue>>ParseResultFormatter
interfaceSignature
interface ParseResultFormatter<A> { readonly formatError: (error: ParseError) => Effect<A>; readonly formatErrorSync: (error: ParseError) => A; readonly formatIssue: (issue: ParseIssue) => Effect<A>; readonly formatIssueSync: (issue: ParseIssue) => A;}Signature
declare const TreeFormatter: ParseResultFormatter<string>Guards
Returns true if the value is a Composite.
Signature
declare const isComposite: (issue: ParseIssue) => issue is CompositeModel
ArrayFormatterIssue
interfaceRepresents an issue returned by the ArrayFormatter formatter.
Signature
interface ArrayFormatterIssue { readonly _tag: "Composite" | "Pointer" | "Unexpected" | "Missing" | "Refinement" | "Transformation" | "Type" | "Forbidden"; readonly message: string; readonly path: readonly Array<PropertyKey>;}Error that contains multiple issues.
Signature
declare class Composite { constructor(ast: AST, actual: unknown, issues: SingleOrNonEmpty<ParseIssue>, output?: unknown); readonly _tag: "Composite"; readonly actual: unknown; readonly ast: AST; readonly issues: SingleOrNonEmpty<ParseIssue>; readonly output?: unknown;}The Forbidden variant of the ParseIssue type represents a forbidden operation, such as when encountering an Effect that is not allowed to execute (e.g., using runSync).
Signature
declare class Forbidden { constructor(ast: AST, actual: unknown, message?: string); readonly _tag: "Forbidden"; readonly actual: unknown; readonly ast: AST; readonly message?: string;}Error that occurs when a required key or index is missing.
Signature
declare class Missing { constructor(ast: Type, message?: string); readonly _tag: "Missing"; readonly actual: undefined; readonly ast: Type; readonly message?: string;}ParseIssue
typeParseIssue is a type that represents the different types of errors that can occur when decoding/encoding a value.
Signature
type ParseIssue = Type | Missing | Unexpected | Forbidden | Pointer | Refinement | Transformation | CompositeSignature
type Path = SingleOrNonEmpty<PropertyKey>Signature
declare class Pointer { constructor(path: Path, actual: unknown, issue: ParseIssue); readonly _tag: "Pointer"; readonly actual: unknown; readonly issue: ParseIssue; readonly path: Path;}Error that occurs when a refinement has an error.
Signature
declare class Refinement { constructor(ast: Refinement, actual: unknown, kind: "From" | "Predicate", issue: ParseIssue); readonly _tag: "Refinement"; readonly actual: unknown; readonly ast: Refinement; readonly issue: ParseIssue; readonly kind: "From" | "Predicate";}SingleOrNonEmpty
typeSignature
type SingleOrNonEmpty<A> = A | Arr.NonEmptyReadonlyArray<A>Error that occurs when a transformation has an error.
Signature
declare class Transformation { constructor(ast: Transformation, actual: unknown, kind: "Encoded" | "Transformation" | "Type", issue: ParseIssue); readonly _tag: "Transformation"; readonly actual: unknown; readonly ast: Transformation; readonly issue: ParseIssue; readonly kind: "Encoded" | "Transformation" | "Type";}The Type variant of the ParseIssue type represents an error that occurs when the actual value is not of the expected type.
The ast field specifies the expected type, and the actual field contains the value that caused the error.
Signature
declare class Type { constructor(ast: AST, actual: unknown, message?: string); readonly _tag: "Type"; readonly actual: unknown; readonly ast: AST; readonly message?: string;}Error that occurs when an unexpected key or index is present.
Signature
declare class Unexpected { constructor(actual: unknown, message?: string); readonly _tag: "Unexpected"; readonly actual: unknown; readonly message?: string;}Optimisation
Signature
declare function eitherOrUndefined<A, E, R>(self: Effect<A, E, R>): Either<A, E> | undefinedSignature
declare const flatMap: { <A, B, E1, R1>(f: (a: A) => Effect<B, E1, R1>): <E, R>(self: Effect<A, E, R>) => Effect<B, E1 | E, R1 | R>; <A, E, R, B, E1, R1>(self: Effect<A, E, R>, f: (a: A) => Effect<B, E1, R1>): Effect<B, E | E1, R | R1>;}Signature
declare const map: { <A, B>(f: (a: A) => B): <E, R>(self: Effect<A, E, R>) => Effect<B, E, R>; <A, E, R, B>(self: Effect<A, E, R>, f: (a: A) => B): Effect<B, E, R>;}Signature
declare const mapBoth: { <E, E2, A, A2>(options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2; }): <R>(self: Effect<A, E, R>) => Effect<A2, E2, R>; <A, E, R, E2, A2>(self: Effect<A, E, R>, options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2; }): Effect<A2, E2, R>;}Signature
declare const mapError: { <E, E2>(f: (e: E) => E2): <A, R>(self: Effect<A, E, R>) => Effect<A, E2, R>; <A, E, R, E2>(self: Effect<A, E, R>, f: (e: E) => E2): Effect<A, E2, R>;}Signature
declare const orElse: { <E, A2, E2, R2>(f: (e: E) => Effect<A2, E2, R2>): <A, R>(self: Effect<A, E, R>) => Effect<A2 | A, E2, R2 | R>; <A, E, R, A2, E2, R2>(self: Effect<A, E, R>, f: (e: E) => Effect<A2, E2, R2>): Effect<A | A2, E2, R | R2>;}Other
Signature
type DeclarationDecodeUnknown<Out, R> = (u: unknown, options: AST.ParseOptions, ast: AST.Declaration) => Effect.Effect<Out, ParseIssue, R>DecodeUnknown
typeSignature
type DecodeUnknown<Out, R> = (u: unknown, options?: AST.ParseOptions) => Effect.Effect<Out, ParseIssue, R>Signature
declare function isParseError(u: unknown): u is ParseErrorSignature
declare class ParseError extends YieldableError<this> & { readonly _tag: "ParseError";} & Readonly<{ readonly issue: ParseIssue;}> { constructor(args: { readonly issue: ParseIssue; }); readonly [ParseErrorTypeId]: symbol; message: string; [NodeInspectSymbol](): { _id: string; message: string; }; toJSON(): { _id: string; message: string; }; toString(): string;}Signature
declare const try: <A>(options: { catch: (e: unknown) => ParseIssue; try: LazyArg<A>;}) => Either.Either<A, ParseIssue>Type Id
Signature
declare const ParseErrorTypeId: unique symbolParseErrorTypeId
typeSignature
type ParseErrorTypeId = typeof ParseErrorTypeIdValidation
By default the option exact is set to true.
Signature
declare function asserts<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => asserts u is ABy default the option exact is set to true.
Signature
declare function is<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (u: unknown, overrideOptions?: number | ParseOptions) => u is ASignature
declare function validate<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (a: unknown, overrideOptions?: ParseOptions) => Effect<A, ParseIssue, R>Signature
declare function validateEither<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Either<A, ParseIssue>Signature
declare function validateOption<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Option<A>Signature
declare function validatePromise<A, I>(schema: Schema<A, I, never>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => Promise<A>Signature
declare function validateSync<A, I, R>(schema: Schema<A, I, R>, options?: ParseOptions): (u: unknown, overrideOptions?: ParseOptions) => A