Skip to content

Add KeyOf type#12

Closed
AliiiBenn wants to merge 3 commits intomainfrom
add-keyof-type
Closed

Add KeyOf type#12
AliiiBenn wants to merge 3 commits intomainfrom
add-keyof-type

Conversation

@AliiiBenn
Copy link
Member

Summary

  • Add KeyOf[T] type class that returns all member names as a tuple of Literal types
  • Similar to TypeScript's keyof operator
  • Includes evaluator implementation and comprehensive tests

Test plan

  • All 5 new KeyOf tests pass
  • All existing tests continue to pass

AliiiBenn and others added 3 commits March 4, 2026 13:48
Add the KeyOf[T] type that returns all member names of a class
as a tuple of Literal types, similar to TypeScript's keyof operator.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement the evaluator for KeyOf[T] that extracts member names
from class annotations and returns them as a tuple of Literal types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive tests for KeyOf including:
- Basic usage with multiple fields
- Single field class
- Empty class (no fields)
- Class with methods (methods ignored)
- Inheritance (includes parent fields)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AliiiBenn AliiiBenn closed this Mar 5, 2026
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