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

Updating dotenv load and loadSync with assertion + type inference #6388

Open
harrysolovay opened this issue Feb 8, 2025 · 0 comments
Open

Comments

@harrysolovay
Copy link
Contributor

Thoughts on updating the load and loadSync functions such that an assertExists option could be supplied (which would then inform the returned env record)?

import { load } from "@std/dotenv"

const env = await load({
  assertExists: ["STRIPE_API_KEY", "OPENAI_API_KEY", "DATABASE_URL"]
})

env satisfies {
  STRIPE_API_KEY: string
  OPENAI_API_KEY: string
  DATABASE_URL: string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant