UNPKG

@adguard/agtree

Version:
30 lines (29 loc) 1 kB
/** * Result of modifier validation: * - `{ valid: true }` for valid and _fully supported_ modifier; * - `{ valid: true, warn: <deprecation notice> }` for valid * and _still supported but deprecated_ modifier; * - otherwise `{ valid: true, error: <invalidity reason> }` */ export type ValidationResult = { valid: boolean; error?: string; warn?: string; }; /** * Returns invalid validation result with given error message. * * @param error Error message. * * @returns Validation result `{ valid: false, error }`. */ export declare const getInvalidValidationResult: (error: string) => ValidationResult; /** * Returns invalid validation result which uses {@link VALIDATION_ERROR_PREFIX.VALUE_REQUIRED} as prefix * and specifies the given `modifierName` in the error message. * * @param modifierName Modifier name. * * @returns Validation result `{ valid: false, error }`. */ export declare const getValueRequiredValidationResult: (modifierName: string) => ValidationResult;