Skip to content

Feature/typescript type inference - #10

Merged
yasserfedsi merged 10 commits into
mainfrom
feature/typescript-type-inference
Jul 27, 2026
Merged

Feature/typescript type inference#10
yasserfedsi merged 10 commits into
mainfrom
feature/typescript-type-inference

Conversation

@yasserfedsi

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

This release introduces major TypeScript improvements to envfy, making the library fully type-safe while preserving its simple runtime API.

The focus of this release is improving the developer experience through automatic type inference and a cleaner public API.


Motivation

Before this release, validateEnv() correctly validated environment variables at runtime, but the returned object lacked accurate TypeScript inference.

This update allows editors to automatically infer:

  • Primitive types
  • Enum literal values
  • Optional properties
  • Properties with default values

without requiring users to write any additional interfaces or type assertions.


Related Issues

Closes #N/A


Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Documentation update
  • Performance improvement
  • Tests
  • CI/CD

Changes Made

TypeScript

  • Added generic validateEnv<T>().
  • Added automatic schema type inference.
  • Added primitive type inference.
  • Added enum literal type inference.
  • Added optional property inference.
  • Added default value inference.
  • Improved exported public types.
  • Refactored shared type definitions.

Documentation

  • Updated README with:
    • Type inference examples
    • Default value examples
    • Improved feature overview
    • Better API documentation
  • Updated CHANGELOG for v0.6.0.

Developer Experience

  • Improved IntelliSense support.
  • Cleaner public API exports.
  • Better editor autocomplete.

Testing

Automated

  • Existing unit tests pass.
  • Enum validation verified.
  • Optional variable validation verified.
  • Default value validation verified.

Manual

Verified by creating a sample project and testing:

  • Valid environment variables.
  • Invalid primitive values.
  • Invalid enum values.
  • Missing required variables.
  • Optional variables.
  • Default values.
  • TypeScript inference inside VS Code.

Breaking Changes

  • No breaking changes.

All existing runtime behavior remains compatible.


Documentation

  • README updated.
  • CHANGELOG updated.
  • Public API examples updated.

Checklist

  • Code follows the project's coding standards.
  • Self-review completed.
  • Existing tests pass.
  • Documentation updated.
  • No unnecessary dependencies introduced.
  • Ready for review.

Additional Notes

This release focuses on developer experience rather than runtime functionality.

With automatic TypeScript inference now supported, envfy provides a more intuitive and type-safe API while maintaining zero runtime dependencies and a lightweight footprint.

@yasserfedsi
yasserfedsi merged commit 7008e9b into main Jul 27, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in envfy Jul 27, 2026
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

Successfully merging this pull request may close these issues.

1 participant