Skip to content

feat: implement ConvertField type operator#36

Open
AliiiBenn wants to merge 3 commits intomainfrom
feat/convert-field-clean
Open

feat: implement ConvertField type operator#36
AliiiBenn wants to merge 3 commits intomainfrom
feat/convert-field-clean

Conversation

@AliiiBenn
Copy link
Member

Summary

Implements the ConvertField helper type as mentioned in PEP 827 for extracting underlying types from ORM field descriptors.

ConvertField[T, K] extracts the underlying type from field K in type T:

  • Property[T] -> T (returns the raw type)
  • Link[T] -> PropsOnly[T] (for one-to-one relations)
  • MultiLink[T] -> list[PropsOnly[T]] (for one-to-many relations)

Includes PropsOnly as a dependency.

Changes

  • Add ConvertField class to typing.py
  • Add PropsOnly class to typing.py (dependency)
  • Add evaluators in _eval_operators.py
  • Add basic tests

Test plan

  • All ConvertField tests pass
  • Ruff passes

Related: #29

🤖 Generated with Claude Code

AliiiBenn and others added 3 commits March 9, 2026 11:24
Add ConvertField[T, K] operator that extracts the underlying
type from ORM field descriptors.

- Property[T] -> T
- Link[T] -> T (wrapped in PropsOnly for relations)
- MultiLink[T] -> list[T] (wrapped in PropsOnly)

Includes PropsOnly as dependency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AliiiBenn AliiiBenn linked an issue Mar 9, 2026 that may be closed by this pull request
9 tasks
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.

[FEATURE] Implement ConvertField helper type

1 participant