8.1.6 • Published 3 months ago

@types/dotenv-safe v8.1.6

Weekly downloads
19,215
License
MIT
Repository
github
Last release
3 months ago

Installation

npm install --save @types/dotenv-safe

Summary

This package contains type definitions for dotenv-safe (https://github.com/rolodato/dotenv-safe).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dotenv-safe.

index.d.ts

// Type definitions for dotenv-safe 8.1
// Project: https://github.com/rolodato/dotenv-safe
// Definitions by: Stan Goldmann <https://github.com/krenor>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2

import dotenv = require('dotenv');

export interface MissingEnvVarsError extends Error {
    /**
     * Path to example environment file.
     */
    sample: string;

    /**
     * Variables which existing in the sample file, but not in the loaded file.
     */
    missing: string[];
}

export interface DotenvSafeOptions extends dotenv.DotenvConfigOptions {
    /**
     * Path to example environment file. (Option 1)
     * @default ".env.example"
     */
    example?: string | undefined;

    /**
     * Path to example environment file. (Option 2 -- example takes precedence)
     * @default ".env.example"
     */
    sample?: string | undefined;

    /**
     * Enabling this option will not throw an error after loading.
     * @default false
     */
    allowEmptyValues?: boolean | undefined;
}

export interface DotenvSafeConfigOutput extends dotenv.DotenvConfigOutput {
    /**
     * key-value pairs required by .env.example
     */
    required: dotenv.DotenvParseOutput;
}

/**
 * Loads environment variables file into 'process.env'.
 *
 * @throws MissingEnvVarsError
 */
export function config(options?: DotenvSafeOptions): DotenvSafeConfigOutput;

Additional Details

  • Last updated: Thu, 08 Jul 2021 09:08:52 GMT
  • Dependencies: @types/dotenv
  • Global values: none

Credits

These definitions were written by Stan Goldmann.