class ParseError extends Error {
    type = "ParseError";

    public trace: NestedArray<string> = [];

    constructor(
        public input: any,
        trace: NestedArray<string> | string,
        public readonly msg: string,
    ) {
        super(msg);
    }
}

type NestedArray<T> = T | NestedArray<T>[];

export interface Schema<T> {
    parse(input: unknown): Result<T, ParseError>;
}
