Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add typedefs for dotenv and dotenv-expand
- Loading branch information
1 parent
8b8e900
commit 9cf1b22
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// @flow strict-local | ||
|
||
declare module 'dotenv-expand' { | ||
import type {DotenvConfigOutput} from 'dotenv'; | ||
|
||
declare module.exports: (config: DotenvConfigOutput) => DotenvConfigOutput; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// @flow strict-local | ||
|
||
// Derived from and sections taken from | ||
// https://github.com/motdotla/dotenv/blob/03a891554c49915fe919c649f51b3adcae662a84/lib/main.js | ||
// and https://github.com/flow-typed/flow-typed/blob/9b8ade1b0dd93ae110a5612cce80d81d0c34a00e/definitions/npm/dotenv_v4.x.x/flow_v0.34.x-/dotenv_v4.x.x.js | ||
// both of which are MIT licensed (see roots of their respective repos) | ||
declare module 'dotenv' { | ||
declare type DotenvParseOptions = {| | ||
debug?: boolean | ||
|}; | ||
|
||
// keys and values from src | ||
declare type DotenvParseOutput = {[string]: string}; | ||
|
||
declare type DotenvConfigOptions = {| | ||
path?: string, // path to .env file | ||
encoding?: string, // encoding of .env file | ||
debug?: string // turn on logging for debugging purposes | ||
|}; | ||
|
||
declare type DotenvConfigOutput = {| | ||
parsed?: DotenvParseOutput, | ||
error?: Error | ||
|}; | ||
|
||
declare module.exports: { | ||
config(options: ?DotenvConfigOptions): DotenvConfigOutput, | ||
parse(src: string | Buffer, options: ?DotenvParseOptions): DotenvParseOutput | ||
}; | ||
} |