Skip to content

feat: perfect type safety implementation#3

Merged
dustintownsend merged 6 commits intomainfrom
feature/perfect-type-safety
Nov 20, 2025
Merged

feat: perfect type safety implementation#3
dustintownsend merged 6 commits intomainfrom
feature/perfect-type-safety

Conversation

@dustintownsend
Copy link
Copy Markdown
Contributor

No description provided.

dustintownsend and others added 6 commits November 20, 2025 09:08
- 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>
@dustintownsend dustintownsend marked this pull request as ready for review November 20, 2025 23:09
@dustintownsend dustintownsend merged commit e6646b9 into main Nov 20, 2025
@dustintownsend dustintownsend deleted the feature/perfect-type-safety branch November 20, 2025 23:09
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