UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

17 lines (16 loc) 672 B
import { StringMap } from '../../core/public-api'; /** * Defines how a error object (validator key, error object, the control object) should be mapped to string. */ export interface ErrorMapperInterface { /** * Maps an error to a string. * @param {string} key the error key. i.e., required, etc * @param error the error object * @param control control Object (AbstractControl for Angular, NgModel for AngularJS) * @returns {string} */ map(key: string, error?: unknown, control?: unknown): string; } export type ErrorsMapperFn = (error: Record<string, unknown>) => string; export type ErrorMapper = ErrorMapperInterface | StringMap;