feat: perfect type safety implementation#3
Merged
dustintownsend merged 6 commits intomainfrom Nov 20, 2025
Merged
Conversation
- Add src/types/field-config.ts with FieldConfigState types - Update BaseFieldBuilder to include TConfig type parameter - Update all field builder interfaces with config parameter - Update type inference to check _configState instead of _config This is Step 1 of the perfect type safety implementation. The runtime implementations (Step 2) need to be updated next to match the new interfaces. Currently TypeScript shows expected errors because the classes haven't been updated yet. Related to #perfect-type-safety
Updated all field builder implementations to include the TConfig type
parameter, enabling perfect type-level tracking of field configuration
state for accurate type inference in insert operations.
Changes:
- Updated FieldBuilder base class to include TConfig parameter
- Updated all primitive builders (String, Number, Boolean, Date)
- Updated all MongoDB-specific builders (ObjectId, PublicId, etc.)
- Updated all complex builders (Array, Record, Union)
- Updated factory functions to match new signatures
- Fixed EmptyConfig to be {} instead of explicit false values
- Fixed InferFieldBuilderType to accept 3 type parameters
All 107 tests passing. TypeScript compilation successful.
Fields with defaults/auto-generation now correctly optional for inserts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Soft delete flags should implicitly default to null when creating records, making them optional for insert operations just like fields with explicit defaults. Updated HasDefault type helper to recognize isSoftDeleteFlag fields as having an implicit default value. All 107 tests passing. Zero type errors in examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.