import { DetailedResult, Result } from '../base'; import { Converter, ConverterFunc } from '../conversion'; import { Validator } from '../validation'; import { KeyValueEntry } from './common'; import { ResultMapResultDetail } from './readonlyResultMap'; /** * Parameters for constructing a {@link Collections.KeyValueConverters | KeyValueConverters} instance. * @public */ export interface IKeyValueConverterConstructorParams { /** * Required key {@link Validator | validator}, {@link Converter | converter}, * or {@link Conversion.ConverterFunc | converter function}. */ key: Validator | Converter | ConverterFunc; /** * Required value {@link Validator | validator}, {@link Converter | converter}, * or {@link Conversion.ConverterFunc | converter function}. */ value: Validator | Converter | ConverterFunc; } /** * Helper class for converting strongly-typed keys, values, or entries * from unknown values. * @public */ export declare class KeyValueConverters { /** * Required key {@link Validator | validator} or {@link Converter | converter}. */ readonly key: Validator | Converter; /** * Required value {@link Validator | validator} or {@link Converter | converter}. */ readonly value: Validator | Converter; /** * Constructs a new key-value validator. * @param key - Required key {@link Validator | validator}, {@link Converter | converter}, * or {@link Conversion.ConverterFunc | converter function}. * @param value - Required value {@link Validator | validator}, {@link Converter | converter}, * or {@link Conversion.ConverterFunc | converter function}. */ constructor({ key, value }: IKeyValueConverterConstructorParams); /** * Converts a supplied unknown to a valid key value of type ``. * @param key - The unknown to be converted. * @returns `Success` with the converted key value and 'success' detail if the key is valid, * or `Failure` with an error message and 'invalid-key' detail if the key is invalid. */ convertKey(key: unknown): DetailedResult; /** * Converts a supplied unknown to a valid value of type ``. * @param key - The unknown to be converted. * @returns `Success` with the converted value and 'success' detail if the value is valid, * or `Failure` with an error message and 'invalid-value' detail if the value is invalid. */ convertValue(key: unknown): DetailedResult; /** * Converts a supplied unknown to a valid entry of type `[, ]`. * @param entry - The unknown to be converted. * @returns `Success` with the converted entry and 'success' detail if the entry * is valid, or `Failure` with an error message and 'invalid-key' or 'invalid-value' detail if * the entry is invalid */ convertEntry(entry: unknown): DetailedResult, ResultMapResultDetail>; /** * Converts a supplied iterable of unknowns to valid key-value pairs. * @param entries - The iterable of unknowns to be converted. * @returns `Success` with an array of converted key-value pairs if all entries are valid, * or `Failure` with an error message if any entry is invalid. */ convertEntries(entries: Iterable): Result[]>; } //# sourceMappingURL=keyValueConverters.d.ts.map