Repository navigation
2.0.0-next.20
Pre-release
Pre-release
What’s Changed
Typed getAttribute() / setAttribute() inference
- Improved
getAttribute()so it now infers the return type from declared model properties, not just schema/generic attributes. - Improved
setAttribute()so writes against declared model properties are type-checked consistently withgetAttribute()reads.
Declared property support
- Models with explicit declarations like
declare name: stringnow get strongly typed attribute access:user.getAttribute('name')resolves tostringuser.setAttribute('name', value)enforcesstring
Relationship-aware attribute access
- Extended attribute typing to relationship method keys when the relationship has been loaded onto the model.
getAttribute()now resolves the expected relationship payload type from the relationship method’sgetResults()contract:- single-result relations resolve to
RelatedModel | null - multi-result relations resolve to
ArkormCollection<RelatedModel>
- single-result relations resolve to
setAttribute()mirrors that behavior for assigning eager-loaded relationship payloads.
Type utilities
- Added internal model relationship typing helpers to derive:
- which model method names represent relationships
- what resolved payload type each relationship exposes
Test coverage
- Added type-level regression coverage for:
- generic attribute inference
- declared property inference
- relationship payload inference for
hasOneandhasMany - typed
setAttribute()parity withgetAttribute()
Developer Impact
- Better IDE autocomplete and stronger compile-time guarantees when reading or assigning model attributes.
- Less need for manual casts around eager-loaded relationships and declared model fields.
Full Changelog: 2.0.0-next.17...2.0.0-next.20