Skip to content

v1.3.0

Choose a tag to compare

@CatchMe2 CatchMe2 released this 28 Jan 14:00
· 3 commits to main since this release

What's Changed

New Contributors

✨ Added

createConfig — Typed computed configuration values

  • Introduced createConfig, a new helper that builds on parseEnv to support computed (derived) configuration values.
  • Computed values:
    • Are calculated after schema validation
    • Receive the fully parsed and typed config (not raw strings)
    • Support flat and deeply nested structures
    • Are deep-merged with the parsed schema output
  • Full TypeScript type inference for:
    • Parsed environment variables
    • Computed values (including nested and mixed structures)
  • Computed functions are skipped if schema validation fails, ensuring safety and correctness.
const config = createConfig(process.env, {
  schema: {
    db: {
      host: envvar('DB_HOST', z.string()),
      port: envvar('DB_PORT', z.coerce.number()),
    },
  },
  computed: {
    dbUrl: (raw) => `${raw.db.host}:${raw.db.port}`,
  },
});

**Full Changelog**: https://github.com/CatchMe2/envase/compare/v1.2.2...v1.3.0