import { ErrorMessages, GenericFnOpt } from '../../rules/types'; /** Get the value of an error message */ export function ruleMessage( errorMessages: ErrorMessages, key: string, args: T[] = [] ): string { if (typeof errorMessages[key] === 'function') { return (errorMessages[key] as GenericFnOpt)(...args); } return errorMessages[key] as string; }