import type { FreeSemigroup } from "../../FreeSemigroup"; /* * ------------------------------------------- * DecodeError Model * ------------------------------------------- */ export const required = "required"; export const optional = "optional"; export type Kind = typeof required | typeof optional; export interface Leaf { readonly _tag: "Leaf"; readonly actual: unknown; readonly expected: string; } export interface Info { readonly _tag: "Info"; error: E; } export interface Key { readonly _tag: "Key"; readonly key: string; readonly kind: Kind; readonly errors: FreeSemigroup>; } export interface Index { readonly _tag: "Index"; readonly index: number; readonly kind: Kind; readonly errors: FreeSemigroup>; } export interface Member { readonly _tag: "Member"; readonly index: number; readonly errors: FreeSemigroup>; } export interface Lazy { readonly _tag: "Lazy"; readonly id: string; readonly errors: FreeSemigroup>; } export interface Wrap { readonly _tag: "Wrap"; readonly error: E; readonly errors: FreeSemigroup>; } export type DecodeError = Leaf | Key | Index | Member | Lazy | Wrap | Info;