/** * @module EnvAccessor */ import { type IInitizable, type UndefinedToNull } from "../../utilities/_module.js"; /** * @group Contracts */ export type RawEnvConfig = Partial>; /** * @group Contracts */ export type BaseEnvConfig = Partial>; /** * `IEnvAccessor` provides type-safe access to env variables. * * @group Contracts */ export type IEnvAccessor = IInitizable & { /** * Get a value from the environment config, or null if missing/undefined. * * @param field The env field to retrieve. * @returns The value or null if not present. * @throws {UninitializedEnvAccessorError} If called before initialization. */ get(field: TField): UndefinedToNull; /** * Get a value from the environment config, or return default value. * * @param field The env field to retrieve. * @param defaultValue The default value when not found. * @returns The value or default value. * @throws {UninitializedEnvAccessorError} If called before initialization. */ getOr(field: TField, defaultValue: NonNullable): NonNullable; };