@placeholdersoft/typed-env
Version:
typed-env can help us better handle environment variables
26 lines (25 loc) • 854 B
TypeScript
import { Dict, EnvBox } from './env-box';
/**
* Set the global environment for the current process.
*
* @param env The environment to set.
* @example injectGlobalEnv(process.env) | injectGlobalEnv({"app_version": "0.0.1"})
*
*/
export declare const injectGlobalEnv: (env: Dict<string>) => void;
/**
*
* @param key env key
* @returns EnvBox
*
* @description support evn-name type check, default env source is process.env, if you want to use other env source, you can use injectGlobalEnv
*
*/
export declare function typedEnv<T extends string>(key: T): EnvBox<string | undefined>;
/**
* @param key env key
* @returns EnvBox
*
* @description can be any env-name, default env source is process.env, if you want to use other env source, you can use injectGlobalEnv
*/
export declare function anyEnv(key: string): EnvBox<string | undefined>;