diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..c7dc831 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,19 @@ +export interface EnvironmentVariables { + readonly [key: string]: string; +} + +/** + * Get the environment variables defined in your dotfiles. + * + * @param shell - The shell to read the environment variables from. Default: User default shell. + * @returns The environment variables. + */ +export function sync(shell?: string): EnvironmentVariables; + +/** + * Get the environment variables defined in your dotfiles. + * + * @param shell - The shell to read the environment variables from. Default: User default shell. + * @returns The environment variables. + */ +export default function shellEnv(shell?: string): Promise; diff --git a/index.test-d.ts b/index.test-d.ts new file mode 100644 index 0000000..a5ef803 --- /dev/null +++ b/index.test-d.ts @@ -0,0 +1,5 @@ +import {expectType} from 'tsd-check'; +import shellEnv, {sync, EnvironmentVariables} from '.'; + +expectType(sync()); +expectType(await shellEnv()); diff --git a/package.json b/package.json index 2448148..a529455 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,11 @@ "node": ">=6" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd-check" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "keywords": [ "env", @@ -39,6 +40,7 @@ }, "devDependencies": { "ava": "*", + "tsd-check": "^0.3.0", "xo": "*" } }