Skip to content

Derive @bust/config types from the schema - #5

Merged
busticated merged 2 commits into
mainfrom
feature/config-generic-types
Aug 24, 2026
Merged

busticated merged 2 commits into
mainfrom
feature/config-generic-types

Conversation

@busticated

Copy link
Copy Markdown
Owner

Description

Config.get() returned a seven-member union for a key typed as plain string, so every call site had to coerce or cast the result and a typo'd key only surfaced at runtime. This threads the schema's shape through as a type parameter, so e.g. get('app.port') returns number, an enum format returns its literal union, and an undeclared key is a compile error.

How to Test

  1. Clone and setup this branch locally (docs)
  2. Run unit tests: npm test
  3. Run end-to-end tests: npm run test:e2e
  4. In a scratch file under packages/config/src/, call createConfig() with a schema using several formats, in your IDE hover the get() results, then run npm run typecheck

Outcome

All tests pass. Each get() call reports the type its format implies rather than SettingsValue, an undeclared key fails typecheck, and an untyped new Config() still accepts any string key.

Related / Discussions

N/A

Completeness

  • PR opened 🎉
  • Testing instructions have been provided
  • Docs have been updated (npm run docs:build)
  • Changes adhere to repo conventions
  • Development How-To's have been provided
  • Branch is rebased against target (typically main)

@busticated busticated self-assigned this Aug 24, 2026
@busticated
busticated merged commit 99d60bb into main Aug 24, 2026
6 checks passed
@busticated
busticated deleted the feature/config-generic-types branch August 24, 2026 20:27
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