-
-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Labels
breaking changeBreaking changeBreaking changecomponent/vocabActivity Vocabulary relatedActivity Vocabulary relateddifficulty/intermediateIntermediate levelIntermediate levelpriority/criticalCritical issues that need immediate attentionCritical issues that need immediate attention
Milestone
Description
Summary
Fedify follows the principle of immutability by default, but currently most type and interface fields don't have readonly
modifiers. Similarly, arrays are declared as T[]
instead of readonly T[]
. This change would make the type system better reflect Fedify's immutability principles.
Background
While this improvement has been desired for some time, it was previously blocked by backward compatibility concerns. With Fedify 2.0, we can introduce this breaking change to improve type safety and better express the library's immutability design.
Proposed Changes
- Add
readonly
modifiers to interface and type fields throughout the codebase - Replace
T[]
withreadonly T[]
for array types where appropriate - Ensure this change is consistently applied across all packages in the monorepo
Impact
- Breaking change: This will be a breaking change for users who rely on mutating Fedify objects
- Type safety: Improved compile-time guarantees about immutability
- Design consistency: Types will better reflect Fedify's immutability-first design principles
Scope
This change should be applied to:
- Core Fedify types in
packages/fedify/
- Integration packages (
@fedify/hono
,@fedify/express
, etc.) - Database adapter packages
- Any other relevant type definitions across the monorepo
Target
- Target branch:
next
(as this is a breaking change for Fedify 2.0)
Acceptance Criteria
- All relevant interface and type fields have appropriate
readonly
modifiers - Array types are changed from
T[]
toreadonly T[]
where appropriate - All packages in the monorepo are updated consistently
- Tests pass after the changes
- No unintentional breaking changes beyond the intended immutability enforcement
Metadata
Metadata
Assignees
Labels
breaking changeBreaking changeBreaking changecomponent/vocabActivity Vocabulary relatedActivity Vocabulary relateddifficulty/intermediateIntermediate levelIntermediate levelpriority/criticalCritical issues that need immediate attentionCritical issues that need immediate attention