Skip to content

Instantly share code, notes, and snippets.

View amanzrx4's full-sized avatar

aman sagar amanzrx4

View GitHub Profile
@amanzrx4
amanzrx4 / env-variables.ts
Last active June 17, 2024 09:47
type safe env variable parsing with valibot
import { config } from 'dotenv';
import type { InferInput, ValiError } from 'valibot';
import { object, parse, string } from 'valibot';
config();
const envVariables = object({
MY_KEY: string(),
});
parse(envVariables, process.env);