import { OptionalKeys, RequiredKeys } from "../utils/types"; //#region src/config/format.d.ts type ConfigValue = string | number | boolean | null | ConfigValue[] | Config; type Config = { [keyOrDotNotation: string]: ConfigValue | undefined; }; type NormalizedConfigValue = string | number | boolean | NormalizedConfig | NormalizedConfigValue[]; type NormalizedConfig = { [key: string]: NormalizedConfigValue | undefined; }; type _NormalizesTo = N extends object ? (Config & { [K in OptionalKeys]?: _NormalizesTo | null } & { [K in RequiredKeys]: undefined extends N[K] ? _NormalizesTo | null : _NormalizesTo } & { [K in `${string}.${string}`]: ConfigValue }) : N; type NormalizesTo = _NormalizesTo; /** * Note that a config can both be valid and not normalizable. */ declare function isValidConfig(c: unknown): c is Config; declare function getInvalidConfigReason(c: unknown, options?: { configName?: string; }): string | undefined; declare function assertValidConfig(c: unknown): void; declare function override(c1: Config, ...configs: Config[]): Config; /** * Removes keys from a config override, using the same nested key logic as the `override` function. * Resetting key "a.b" also resets "a.b.c" (and any other descendants). * Handles both flat dot-notation keys and nested object keys. */ declare function removeKeysFromConfig(config: Config, keysToRemove: string[]): Config; type NormalizeOptions = { /** * What to do if a dot notation is used on a value that is not an object. * * - "throw" (default): Throw an error. * - "ignore": Ignore the dot notation field. */ onDotIntoNonObject?: "throw" | "ignore"; /** * What to do if a dot notation is used on a value that is null. * * - "like-non-object" (default): Treat it like a non-object. See `onDotIntoNonObject`. * - "throw": Throw an error. * - "ignore": Ignore the dot notation field. * - "empty-object": Set the value to an empty object. */ onDotIntoNull?: "like-non-object" | "throw" | "ignore" | "empty-object"; /** * If provided, keys that are silently dropped during normalization (when a dot-notation key * references a parent that doesn't exist or is not an object and the behavior is "ignore") * will be pushed to this array. */ droppedKeys?: string[]; }; declare class NormalizationError extends Error { constructor(...args: ConstructorParameters); } declare function isNormalized(c: Config): c is NormalizedConfig; declare function assertNormalized(c: Config): asserts c is NormalizedConfig; declare function normalize(c: Config, options?: NormalizeOptions): NormalizedConfig; //#endregion export { Config, ConfigValue, NormalizationError, NormalizedConfig, NormalizedConfigValue, NormalizesTo, _NormalizesTo, assertNormalized, assertValidConfig, getInvalidConfigReason, isNormalized, isValidConfig, normalize, override, removeKeysFromConfig }; //# sourceMappingURL=format.d.ts.map