import { NoInferType, Path, PathValue } from './types'; /** * `ExcludeUndefinedIf * * If `ExcludeUndefined` is `true`, remove `undefined` from `T`. * Otherwise, constructs the type `T` with `undefined`. */ declare type ExcludeUndefinedIf = ExcludeUndefined extends true ? Exclude : T | undefined; export interface ConfigGetOptions { /** * If present, "get" method will try to automatically * infer a type of property based on the type argument * specified at the "ConfigService" class-level (example: ConfigService). */ infer: true; } declare type KeyOf = keyof T extends never ? string : keyof T; export declare class ConfigService, WasValidated extends boolean = false> { private readonly internalConfig; private set isCacheEnabled(value); private get isCacheEnabled(); private readonly cache; private _isCacheEnabled; constructor(internalConfig?: Record); /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * @param propertyPath */ get(propertyPath: KeyOf): ExcludeUndefinedIf; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * @param propertyPath * @param options */ get = any, R = PathValue>(propertyPath: P, options: ConfigGetOptions): ExcludeUndefinedIf; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * It returns a default value if the key does not exist. * @param propertyPath * @param defaultValue */ get(propertyPath: KeyOf, defaultValue: NoInferType): T; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * It returns a default value if the key does not exist. * @param propertyPath * @param defaultValue * @param options */ get = any, R = PathValue>(propertyPath: P, defaultValue: NoInferType, options: ConfigGetOptions): R; private getFromCache; private getFromValidatedEnv; private getFromProcessEnv; private getFromInternalConfig; private setInCacheIfDefined; private isGetOptionsObject; } export {};