TypedConfig 1.0.0

dotnet add package TypedConfig --version 1.0.0
                    
NuGet\Install-Package TypedConfig -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TypedConfig" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TypedConfig" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TypedConfig" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TypedConfig --version 1.0.0
                    
#r "nuget: TypedConfig, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TypedConfig@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TypedConfig&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TypedConfig&version=1.0.0
                    
Install as a Cake Tool

TypedConfig

TypedConfig is a lightweight F# library for loading configuration into strongly typed records with validation.

It maps environment variables into F# record types, ensuring type safety and clear error reporting.

Features

  • Load configuration into F# records using generics
  • Built-in parsing for common types (string, int, bool)
  • Accumulates validation errors instead of failing fast
  • Environment variable source support
  • Small API surface with explicit Result-based errors

Requirements

  • .NET 10 SDK
  • Paket for dependency restore

Example

open TypedConfig

type Config =
    {
        DATABASE_URL: string
        PORT: int
        DEBUG: bool
    }

let result =
    Api.load<Config> ()

If all required environment variables are present and valid, the result is:

Ok {
    DATABASE_URL = "localhost"
    PORT = 5000
    DEBUG = true
}

or

Error [
    MissingVariable "DATABASE_URL"
    InvalidValue ("PORT", "abc", "int")
    UnsupportedType "DateTime"
]

Supported Types

TypedConfig currently supports these record field types:

  • string
  • int
  • bool

Unsupported field types return an UnsupportedType error.

Development

dotnet build
dotnet test

NuGet Packaging and Publishing

Package metadata is defined in TypedConfig/TypedConfig.fsproj for SDK-style packing.

Publishing is automated by GitHub Actions via .github/workflows/nuget-publish.yml.

Release flow:

  1. Ensure GitHub secret NUGET_API_KEY is configured in the repository settings.
  2. Create and push a version tag in format *.*.* (for example 0.1.0).
  3. Workflow restores, builds, tests, packs, and publishes the package to NuGet.org.

Example:

git tag 0.1.0
git push origin 0.1.0

The repository uses Paket files:

  • paket.dependencies
  • paket.lock
  • TypedConfig/paket.references
  • TypedConfig.Tests/paket.references

Motivation

TypedConfig helps eliminate boilerplate configuration code and runtime errors caused by missing or invalid values, while keeping the API simple and idiomatic for F# developers.

Status

Early stage. API may change. Planned future extensions include additional sources, optional fields, custom field names, enum parsing, and nested records.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 83 5/31/2026