
Typeconf
Adding types for your configuration
npx @typeconf/typeconf build configs
1// Define configuration models with TypeSpec
2model ProjectConfig {
3 name: string;
4 modes: Array<string>;
5 pricingCoeffs: Record<float32>;
6}
1// Generate type-safe configs using Typescript
2import {
3 ProjectConfig,
4} from "~/types/all.js";
5
6let config: ProjectConfig = {
7 name: "my-service",
8 modes: ["current", "new_test"],
9 pricingCoeffs: {
10 "london": 0.99,
11 "nyc": 1.25,
12 "sf": 9000.0,
13 },
14};
15
16export default config;
1{
2 "name": "my-service",
3 "modes": [
4 "current",
5 "new_test"
6 ],
7 "pricingCoeffs": {
8 "london": 0.99,
9 "nyc": 1.25,
10 "sf": 9000
11 }
12}
1// Define configuration models with TypeSpec
2model ProjectConfig {
3 name: string;
4 modes: Array<string>;
5 pricingCoeffs: Record<float32>;
6}
1// Generate type-safe configs using Typescript
2import {
3 ProjectConfig,
4} from "~/types/all.js";
5
6let config: ProjectConfig = {
7 name: "my-service",
8 modes: ["current", "new_test"],
9 pricingCoeffs: {
10 "london": 0.99,
11 "nyc": 1.25,
12 "sf": 9000.0,
13 },
14};
15
16export default config;
1{
2 "name": "my-service",
3 "modes": [
4 "current",
5 "new_test"
6 ],
7 "pricingCoeffs": {
8 "london": 0.99,
9 "nyc": 1.25,
10 "sf": 9000
11 }
12}
Configuration is messy. We have many different formats, YAML, JSON, random ini files, not to mention environment variables. It's hard to track changes and easy to break stuff. So we thought let's add types there! Our tool, Typeconf, allows you to define types for your configuration and read it in your code.
Features
Type-Safe Configuration
Network Storage
Powered by TypeSpec
First-Class Types
NPM Integration
Runtime Performance
Schema Validation
Multi-Language Support
Use Cases
model ProductParams { deviceType: string; coefficient: number; isEnabled: boolean; } model ProductFlags { params_by_user_id: Record<ProductParams>; params_by_device: Record<ProductParams>; }
Feature flags and gradual rollouts
With Typeconf you can define product flags based on device type, user id, and whatever else you want.
LLM validation
You can put LLM configuration including prompts in Typeconf configs and quickly iterate over changes while keeping track of historical values.
model AgentConfig { prompt: string; model: string; temperature: number; }
// types model Route { path: string; backend: string; rateLimit: int32; } model APIGatewayConfig { routes: Record<Route>; } // values import { APIGatewayConfig } from "~/types/all.js"; let config: APIGatewayConfig = { routes: { "/user": { path: "/user", backend: "user-service", rateLimit: 1000, }, "/order": { path: "/order", backend: "order-service", rateLimit: 500, }, }, }; export default config;
Infrastructure configs
You can replace tons of hard to support YAMLs with simple configuration in Typescript.
Inventory storage
You can define Typeconf configs for your data that changes rarely, like employee portal information, device firmware list.
model Employee { employeeId: string; name: string; email: string; role: string; } model EmployeeInventory { employees: Record<Employee>; }