Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic getEnvObject #3

Open
annybs opened this issue Nov 26, 2021 · 0 comments
Open

Generic getEnvObject #3

annybs opened this issue Nov 26, 2021 · 0 comments
Labels

Comments

@annybs
Copy link
Member

annybs commented Nov 26, 2021

static getEnvObject(key: string, defaultValue: Record<string, unknown>): Record<string, unknown> {

This could be made generic to support complex typing at time of read, rather than later in user code:

static getEnvObject<T = Record<string, unknown>>(key: string, defaultValue: T): T

Possibly with defaultValue: T? to allow undefined default.

I'm not sure what the implications are for casting the JSON.parse result, but I believe it returns any so might be permissible without too much work.

@annybs annybs added the feature label Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant