UNPKG

awesome-ajv-errors

Version:
34 lines (33 loc) 1.18 kB
import type { ValidateFunction } from "ajv"; import { PrettificationCore } from "./types"; import { ManagerOptions } from "./style/interface.js"; import { PrintCode } from "./code/types.js"; export interface PrettifyOptions extends PrettificationCore { /** * Defaults to what stdout is detected to support, but can be forced to * true or false. */ colors?: boolean; /** * Include (if possible) the location of the error using a pretty-printed * code-frame. * * Defaults to `true` */ location?: boolean; /** * When pretty-printing (if `location` is enabled), print big numbers * before each error if there are multiple errors. * * Defaults to `true` in Node.js (if location is enabled) and `false` * otherwise. */ bigNumbers?: boolean; } export interface Prettify<Ret> { (opts: PrettifyOptions): Ret; (validate: ValidateFunction, opts: Omit<PrettifyOptions, 'errors' | 'schema'>): Ret; } type Environment = 'node' | 'browser'; export declare function makePrettify(managerOptions: ManagerOptions, printCode: PrintCode, environment: Environment): Prettify<string>; export {};